RAS 19.1 script changes from the 18.1 script
Produced: 11/28/2022 11:57:18 AM
   
Mode:  Differences  
Left file: C:\gitstuff\Parallels-RAS-V19.x-Doc-Script-3.00\RAS_Inventory_V2.5.ps1  
Right file: C:\gitstuff\Parallels-RAS-V19.x-Doc-Script-3.00\RAS_Inventory_V3_0.ps1  
        Creates a complete inventory of a V18.1 or later Parallels Remote Application Server. <>         Creates a complete inventory of a V19.x or later Parallels Remote Application Server.
 
        Creates a complete inventory of a V18.1 or later Parallels Remote Application Server  <>         Creates a complete inventory of a V19.x or later Parallels Remote Application Server 
 
        June 1, 2021 at 6PM is 2021-06-01_1800. <>         June 1, 2023 at 6PM is 2023-06-01_1800.
 
        Output filename will be ReportName_2021-06-01_1800.<ext>. <>         Output filename will be ReportName_2023-06-01_1800.<ext>.
 
        PS C:\PSScript > .\RAS_Inventory_V2.5.ps1 <>         PS C:\PSScript > .\RAS_Inventory_V3.0.ps1
 
        PS C:\PSScript > .\RAS_Inventory_V2.5.ps1 -RASSite EMEASite <>         PS C:\PSScript > .\RAS_Inventory_V3.0.ps1 -RASSite EMEASite
 
        PS C:\PSScript .\RAS_Inventory_V2.5.ps1 -MSWord -CompanyName "Carl Webster  <>         PS C:\PSScript .\RAS_Inventory_V3.0.ps1 -MSWord -CompanyName "Carl Webster 
 
        PS C:\PSScript .\RAS_Inventory_V2.5.ps1 -PDF -CN "Carl Webster Consulting" -CP  <>         PS C:\PSScript .\RAS_Inventory_V3.0.ps1 -PDF -CN "Carl Webster Consulting" -CP 
 
        PS C:\PSScript .\RAS_Inventory_V2.5.ps1 -CompanyName "Sherlock Holmes  <>         PS C:\PSScript .\RAS_Inventory_V3.0.ps1 -CompanyName "Sherlock Holmes 
 
        PS C:\PSScript .\RAS_Inventory_V2.5.ps1 -CompanyName "Sherlock Holmes  <>         PS C:\PSScript .\RAS_Inventory_V3.0.ps1 -CompanyName "Sherlock Holmes 
 
        PS C:\PSScript >.\RAS_Inventory_V2.5.ps1 -Dev -ScriptInfo -Log <>         PS C:\PSScript >.\RAS_Inventory_V3.0.ps1 -Dev -ScriptInfo -Log
 
        PS C:\PSScript > .\RAS_Inventory_V2.5.ps1 -SmtpServer mail.domain.tld -From  <>         PS C:\PSScript > .\RAS_Inventory_V3.0.ps1 -SmtpServer mail.domain.tld -From 
 
        PS C:\PSScript > .\RAS_Inventory_V2.5.ps1 -SmtpServer mailrelay.domain.tld -From  <>         PS C:\PSScript > .\RAS_Inventory_V3.0.ps1 -SmtpServer mailrelay.domain.tld -From 
 
        PS C:\PSScript > .\RAS_Inventory_V2.5.ps1 -SmtpServer  <>         PS C:\PSScript > .\RAS_Inventory_V3.0.ps1 -SmtpServer 
 
        PS C:\PSScript > .\RAS_Inventory_V2.5.ps1 -SmtpServer smtp.office365.com -SmtpPort 587 <>         PS C:\PSScript > .\RAS_Inventory_V3.0.ps1 -SmtpServer smtp.office365.com -SmtpPort 587
 
        PS C:\PSScript > .\RAS_Inventory_V2.5.ps1 -SmtpServer smtp.gmail.com -SmtpPort 587 <>         PS C:\PSScript > .\RAS_Inventory_V3.0.ps1 -SmtpServer smtp.gmail.com -SmtpPort 587
 
        NAME: RAS_Inventory_V2.5.ps1 <>         NAME: RAS_Inventory_V3.0.ps1
        VERSION: 2.53           VERSION: 3.00
 
        LASTEDIT: February 13, 2022 <>         LASTEDIT: November 15, 2022
 
# <>  
#Version 2.53 13-Feb-2022    
#       When processing RD Session Hosts, the script had bad logic that assumed there was always only one RDS Group.    
#               This caused some Agent settings to show as System.Object[] instead of their Numeric or Boolean value    
#               For example:    
#                       Agent settings    
#                               Port                                                  : System.Object[]    
#                               Max Sessions                                          : System.Object[]    
#                               Support Windows Shell URL namespace objects           : System.Object[]    
#                               Allow 2xRemoteExec to send command to the client      : System.Object[]    
#                               Use RemoteApp if available                            : System.Object[]    
#                               Enable applications monitoring                        : System.Object[]    
#                               Allow file transfer command (HTML5 and Chrome clients): System.Object[]    
#                               Do not allow to change location                       : System.Object[]    
#                               Enable drive redirection cache                        : System.Object[]    
#               Oops, my bad. The fix only took one line of code and changing two variables.    
#               Now the results are correct.    
#                       Agent settings    
#                               Port                                                  : 3389    
#                               Max Sessions                                          : 25    
#                               Support Windows Shell URL namespace objects           : True    
#                               Allow 2xRemoteExec to send command to the client      : True    
#                               Use RemoteApp if available                            : False    
#                               Enable applications monitoring                        : True    
#                               Allow file transfer command (HTML5 and Chrome clients): True    
#                               Do not allow to change location                       : False    
#                               Enable drive redirection cache                        : True    
#               Thanks to Thomas Krampe for all his help and remote sessions to track this down    
#    
#Version 2.52 7-Feb-2022    
#       Added Function GetRASStatus to return the full status text for several RAS Status cmdlets    
#               Updated all AgentState outputs to use the value from GetRASStatus    
#       Added HALB output    
#               Virtual Servers    
#                       Properties    
#                       General    
#                       LB gateway payload    
#                       LB SSL payload    
#                       Devices    
#                       Advanced    
#       Changed the date format for the transcript and error log files from yyyy-MM-dd_HHmm format to the FileDateTime format    
#               The format is yyyyMMddTHHmmssffff (case-sensitive, using a 4-digit year, 2-digit month, 2-digit day,     
#               the letter T as a time separator, 2-digit hour, 2-digit minute, 2-digit second, and 4-digit millisecond).     
#               For example: 20221225T0840107271.    
#       Fixed call to Get-RASThemeFooterURL to always return an array (Thanks to Thomas Krampe for the debugging time)    
#       Fixed missing RDS Group Default settings (Thanks to Thomas Krampe)    
#       Fixed several logic errors where I assumed there were always RDS groups    
#       Fixed the German Table of Contents (Thanks to Rene Bigler)    
#               From     
#                       'de-'   { 'Automatische Tabelle 2'; Break }    
#               To    
#                       'de-'   { 'Automatisches Verzeichnis 2'; Break }    
#       For Policy setting Session/Connection/Primary connection/Login/Auto Login, change property name AutoStart to AutoLogin    
#       In Function AbortScript, add test for the winword process and terminate it if it is running    
#               Added stopping the transcript log if the log was enabled and started    
#       In Function OutputFarmSite, only get the first Publishing Agent server for the Farm/Site settings    
#       In Functions AbortScript and SaveandCloseDocumentandShutdownWord, add code from Guy Leech to test for the "Id" property before using it    
#       Replaced most script Exit calls with AbortScript to stop the transcript log if the log was enabled and started    
#       Updated the help text    
#       Updated the ReadMe file    
#       Updated to allow running the script for RAS versions greater than 18.1    
#    
#Version 2.51 11-Sep-2021    
#       Added array error checking for non-empty arrays before attempting to create the Word table for most Word tables    
#       Added Function OutputReportFooter    
#       Added Parameter ReportFooter    
#               Outputs a footer section at the end of the report.    
#               Report Footer    
#                       Report information:    
#                               Created with: <Script Name> - Release Date: <Script Release Date>    
#                               Script version: <Script Version>    
#                               Started on <Date Time in Local Format>    
#                               Elapsed time: nn days, nn hours, nn minutes, nn.nn seconds    
#                               Ran from domain <Domain Name> by user <Username>    
#                               Ran from the folder <Folder Name>    
#       Updated Functions SaveandCloseTextDocument and SaveandCloseHTMLDocument to add a "Report Complete" line    
#       Updated Functions ShowScriptOptions and ProcessScriptEnd to add $ReportFooter    
#       Updated the help text    
#       Updated the ReadMe file    
#    
#Version 2.50 12-Aug-2021    
#       Added a version test so the script only works with RAS 18.1    
#       Added documenting (my best attempt) an Azure provider connection    
#       Added Certificates    
#               Alternate Names    
#               General    
#                       Alternate Names    
#       Added Policies summary    
#       Added Policy Properties (took five days for this one section)    
#               Policy    
#               Policy/Criteria    
#               Session    
#               Session/Connection    
#               Session/Connection/Primary connection    
#               Session/Connection/Secondary connections    
#               Session/Connection/Reconnection    
#               Session/Connection/Computer name    
#               Session/Connection/Advanced settings    
#               Session/Connection/Web authentication    
#               Session/Connection/Multifactor authentication    
#               Session/Connection/Session prelaunch    
#               Session/Connection/Local proxy address    
#               Session/Display    
#               Session/Display/Settings    
#               Session/Display/Multi-monitor    
#               Session/Display/Published applications    
#               Session/Display/Desktop options    
#               Session/Display/Browser    
#               Session/Printing    
#               Session/Scanning    
#               Session/Audio    
#               Session/Keyboard    
#               Session/Local devices and resources    
#               Session/Local devices and resources/Clipboard    
#               Session/Local devices and resources/Disk drives    
#               Session/Local devices and resources/Devices    
#               Session/Local devices and resources/Video capture devices (not in PowerShell yet)    
#               Session/Local devices and resources/Ports    
#               Session/Local devices and resources/Smart cards    
#               Session/Local devices and resources/Windows touch input    
#               Session/Local devices and resources/File transfer    
#               Session/Experience    
#               Session/Experience/Performance    
#               Session/Experience/Compression    
#               Session/Network    
#               Session/Server authentication    
#               Session/Advanced settings    
#               Client options    
#               Client options/Connection    
#               Client options/Logging    
#               Client options/Update    
#               Client options/PC keyboard    
#               Client options/Single Sign-On    
#               Client options/Advanced    
#               Client options/Advanced/Global    
#               Client options/Advanced/Language    
#               Client options/Advanced/Printing    
#               Client options/Advanced/Windows client    
#               Client options/Advanced/RemoteFX USB redirection    
#               Control settings    
#               Control settings/Connections    
#               Control settings/Password    
#               Control settings/Import and export    
#               Redirection    
#       Added Reporting    
#               RAS reporting configuration    
#                       Session information    
#                       Server counters information    
#                       Custom reports    
#               RAS Performance Monitor configuration    
#       Added Themes    
#               General    
#               Messages    
#               HTML5 client/Branding    
#               HTML5 client/Language bar    
#               HTML5 client/Messages    
#               HTML5 client/Gateway    
#               HTML5 client/Legal policies    
#               Windows client/Branding    
#               Windows client/Messages    
#               Windows client/Custom menu    
#       Added to Connection/Multi-factor authentication:    
#               Enable MFA for all users except    
#               Disable MFA for all users except    
#               User or group list    
#               Updated all items and text to match the console (a lot of work)    
#               Added for Azure RADIUS, Duo RADIUS, FortiAuthenticator RADIUS, TekRADIUS, and RADIUS    
#                       Connection    
#                       Attributes    
#                       Automation    
#               Added DeepNet Provider    
#                       Connection    
#                       Application    
#                       Authentication    
#               Added SafeNet Provider    
#                       Connection    
#                       Authentication    
#               Added Google Authenticator    
#                       General    
#       Added to Gateway and Gateway Default Settings:    
#               HTML5/Allow cross-origin resource sharing    
#                       Domains for cross-origin resource sharing    
#                       Browser cache time in months    
#               HTML5/Clipboard redirection    
#               HTML5/File Transfer Direction    
#               HTML5/Use ciphers according to server preference    
#               Wyse/Do not warn if server certificate is not verified    
#       Added to Provider/Agent settings Drag and drop    
#       Added to Published Items their Status    
#               Disabled    
#               Enabled    
#               In maintenance    
#       Added to RD Session Host, RD Session Host Groups, Provider and Default Site Settings:    
#               Agent settings/File Transfer Direction    
#               Agent settings/File Transfer Location    
#               Agent settings/File Transfer Do not allow to change location    
#       Change the wording in Connection/Authentication and Multi-factor authentication to match the console    
#       Fixed a lot of HTML and text formatting issues    
#       In Certificates/General, moved Expiration date to before Common name    
#       In Published Resources, only show Associated File Extensions if the EnableFileExtensions property is True    
#               If you add file extensions and later disable file extensions, the extensions previously entered are still there    
#       Renamed in Gateway/SSL/TLS/HSTS settings "Max-age" to "Browse cache time in months"    
#       Renamed in RDS Host/Agent, RDS Group/Agent, and Provider/Agent settings:    
#               "Support Shell URL namespace objects" to "Support Windows Shell URL namespace objects"    
#       Removed the Restrictions label from Gateways/HTML5 as it is no longer in the console    
#       Updated Function GetVDIType with Hypervisor data for ESXi 7.0 and vCenter 7.0    
#       Updated the Help text    
#       Updated the ReadMe file    
#    
#Version 2.10 25-Apr-2021   #Work on 3.0 started on 15-Nov-2022
#       Fixed wrong variables used to determine User Profile technology    
#       For RD Session Hosts properties:    
#               Renamed the Properties tab to General    
#               Renamed Agent Settings to Agent settings    
#               Renamed User Profile to User profile    
#               Renamed Desktop Access to Desktop access    
#               Renamed RDP Printer to RDP printer    
#       For RD Session Hosts Groups properties:    
#               Renamed Agent Settings to Agent settings    
#               Renamed Desktop Access to Desktop access    
#               Renamed RDP Printer to RDP printer    
#       For RD Session Hosts Schedule properties:    
#               Renamed the Properties tab to General    
#       For VDI Providers properties:    
#               Renamed Agent Settings to Agent settings    
#               Renamed RDP Printer to RDP printer    
#       For Gateways properties:    
#               Renamed the Properties tab to General    
#       For Certificates properties:    
#               Renamed the Properties tab to General    
#       For Administration, Settings:    
#               Rename Customer Experience Program to Customer experience program    
#               Rename HTTP Proxy settings to HTTP proxy settings    
#       For License:    
#               Rename License Details to License details    
#       For VDI, the following changes were made:    
#               Providers tab, added Direct address    
#               Providers properties, renamed the Properties tab to General    
#               Providers properties, Agent settings:    
#                       Removed "Publishing Session Timeout"    
#                       Added "Enable drive redirection cache"    
#               Pools tab:    
#                       Pools:    
#                               Added Last modification by    
#                               Added Modified on    
#                               Added Created by    
#                               Added Created on    
#               Templates tab:    
#                       For template properties, removed Status as I was getting the wrong status property    
#                       Template properties, renamed the Properties tab to General    
#                       Advanced tab, renamed Native Pool to Resource pool    
#       Updated the ReadMe file    
#    
#Version 2.00 20-Apr-2021    
#       Added 59 RDS Agent States    
#       Added a message to the error message for the missing RAS module    
#               Added a link to the V2 ReadMe file    
#       Added a parameter, RASSite, allowing the report to contain data for the specified Site    
#       Added additional Notification handlers types    
#       Added FSLogix to Farm/Site/Settings/Features    
#       Added Function GetFarmSites    
#       Added the missing License section for published RDSH applications to Text and HTML output    
#       Added to Universal Printing/Printer drivers, "Settings are replicated to all Sites"    
#       Added UPD and FSLogix to the User Profile tab for both RD Session Hosts and RD Session Hosts/Groups    
#       Added VDI Pool Member type of "ALLGUESTSONPROVIDER"    
#       Added WVD Apps and Desktops to Publishing    
#       Changed $DesktopSize to use the new values of the DesktopSize property    
#               Removed the property UseAvailableArea as it no longer exists    
#       Changed all RAS cmdlet names to use the new naming scheme Get-RAS*    
#       Changed all Write-Verbose statements from Get-Date to Get-Date -Format G as requested by Guy Leech    
#       Changed Get-RASVDIHost to the new Get-RASProvider    
#       Changed Get-RASVDIHostStatus to the new Get-RASProviderStatus    
#       Changed PoSH module from PSAdmin to RASAdmin    
#       Changed some Write-Warnings to Write-Host as they are not warnings    
#               Reformat most of the Write-Host statements to make the console output look better    
#       Changed the font size of Word/PDF tables from 11 to 10 to prevent most word wrapping to multiple lines    
#       Changed the RDS User Profile Technology to one line instead of two    
#       Changed the variable $MasterPublishingAgent to $PrimaryPublishingAgent    
#               Changed the matching column headings from Master Publishing Agent to Primary Publishing Agent    
#       Changed TWAIN and WIA state from "Unable to retrieve ___ Scanning information" to $False if unable to retrieve data or retrieved no data    
#       Fixed several alignment issues in the text output    
#       Fixed several formatting issues with the HTML and Word/PDF output    
#       Fixed several invalid $Null comparisons    
#       For RD Session Hosts, Agent settings, add the option Enable drive redirection cache    
#       For replicating settings, standardized on the wording "Settings are replicated to all Sites" followed by True or False    
#       In the Administration section, add the following:    
#               Accounts, Receive system notifications    
#               Settings, Miscellaneous, Reset idle RAS Console session after    
#       In the Connection section, add the following:    
#               Allowed devices, headings for Secure Access and Device Access    
#               Allowed devices, Allow only clients with the latest security patches    
#               Allowed devices, Device Access, Mode text label    
#       In the Filters section, reformatted the output to make it more readable (at least to me)    
#       In the Load Balancing section added CPU Optimization    
#       Moved Notification from Administration to Site Settings    
#       Removed all Turbo.net content    
#       Removed Function ProcessSites    
#       Removed MaxGuests from Provider/Agent Settings    
#       Removed property EnableCPULB from Load Balancing section    
#       Removed UPD settings from RD Session Hosts properties and Groups properties    
#       Reorder Parameters in an order recommended by Guy Leech    
#       Reworked how the script processed a Farm with multiple Sites    
#               For most of the Get-RAS* cmdlets, where needed, added the -Site parameter    
#       Updated Function SetWordCellFormat to the latest version    
#       Updated the Allowed authentication types to the new text in the console and handled multiple selections    
#       Updated the help text    
#       Updated the ReadMe file    
#       When retrieving data for Gateways, set variables to values specifying if the Gateway data could not be retrieved or found no Gateway data    
#       When using the output from Get-RASVDITemplate, change VDIHostId to ProviderId    
#       With the addition of the "Last modification by", "Modified on", "Created by", and "Created on"     
#               properties to the PowerShell cmdlets, add those four properties to the relevant report sections    
 
  -+ $SaveEAPreference         = $ErrorActionPreference
    $ErrorActionPreference    = 'SilentlyContinue'
    $Error.Clear()
     
 
$script:MyVersion         = '2.53' <> $script:MyVersion         = '3.00.007'
$Script:ScriptName        = "RAS_Inventory_V2.5.ps1"   $Script:ScriptName        = "RAS_Inventory_V3.0.ps1"
$tmpdate                  = [datetime] "02/13/2022"   $tmpdate                  = [datetime] "11/28/2022"
 
        [int]$wdColorBlack            = 0 <>         #[int]$wdColorBlack            = 0
        [int]$wdColorGray05           = 15987699            #[int]$wdColorGray05           = 15987699 
 
        [int]$wdColorRed              = 255 <>         #[int]$wdColorRed              = 255
 
        [int]$wdColorYellow           = 65535 <>         #[int]$wdColorYellow           = 65535
 
        [int]$wdAlignParagraphLeft = 0 <>         #[int]$wdAlignParagraphLeft = 0
        [int]$wdAlignParagraphCenter = 1           #[int]$wdAlignParagraphCenter = 1
        [int]$wdAlignParagraphRight = 2           #[int]$wdAlignParagraphRight = 2
 
        [int]$wdCellAlignVerticalTop = 0 <>         #[int]$wdCellAlignVerticalTop = 0
        [int]$wdCellAlignVerticalCenter = 1           #[int]$wdCellAlignVerticalCenter = 1
        [int]$wdCellAlignVerticalBottom = 2           #[int]$wdCellAlignVerticalBottom = 2
 
        [int]$wdAutoFitWindow = 2 <>         #[int]$wdAutoFitWindow = 2
 
        [int]$wdAdjustNone = 0 <>         #[int]$wdAdjustNone = 0
 
        [int]$wdAdjustFirstColumn = 2 <>         #[int]$wdAdjustFirstColumn = 2
        [int]$wdAdjustSameWidth = 3           #[int]$wdAdjustSameWidth = 3
 
        [int]$Indent1TabStops = 1 * $PointsPerTabStop <>         #[int]$Indent1TabStops = 1 * $PointsPerTabStop
        [int]$Indent2TabStops = 2 * $PointsPerTabStop           #[int]$Indent2TabStops = 2 * $PointsPerTabStop
        [int]$Indent3TabStops = 3 * $PointsPerTabStop           #[int]$Indent3TabStops = 3 * $PointsPerTabStop
        [int]$Indent4TabStops = 4 * $PointsPerTabStop           #[int]$Indent4TabStops = 4 * $PointsPerTabStop
 
  -+         [int]$wdStyleHeading5 = -6
 
        [int]$wdTableLightListAccent3 = -206 <>         #[int]$wdTableLightListAccent3 = -206
 
  -+         $Script:myHash.Word_Heading5        = $wdStyleheading5
 
  -+                 5 {$Script:Selection.Style = $Script:MyHash.Word_Heading5; Break}
 
        Write-Verbose "$(Get-Date -Format G): RAS Version          : $($Script:RASVersion)" +-  
 
  -+                 $Script:RASFullVersion = $Results
 
                If([version]$Script:RASVersion -ge [version]"18.1") <>                 If([version]$Script:RASVersion -ge [version]"19.1")
 
        This script is designed for RAS 18.1 and should not be run on $Results. <>         This script is designed for RAS 19.1 and should not be run on $Results.
 
        If you are running RAS 18.0, please use:  <>         If you are running RAS 18.x, please use: 
 
  -+                 $Script:RASFullVersion = "Unable to determine"
 
        This script is designed for RAS 18.1 and your RAS version could not be determined. <>         This script is designed for RAS 19.1 and your RAS version could not be determined.
 
        If you are running RAS 18.0, please use:  <>         If you are running RAS 18.x, please use: 
 
                Out-File -FilePath $SIFile -Append -InputObject "RAS Version          : $Script:RASVersion" 4>$Null +-  
 
                $Results = Get-RASPA -SiteId $Site.Id -EA 0 4> $Null | Select -First 1 #changed in 2.52 to only get the first PA <>                 $Results = Get-RASBroker -SiteId $Site.Id -EA 0 4> $Null | Select-Object -First 1 #changed in 2.52 to only get the first PA
 
                $ScriptInformation.Add(@{Data = "Primary Publishing Agent"; Value = $PrimaryPublishingAgent; }) > $Null <>                 $ScriptInformation.Add(@{Data = "Primary Connection Broker"; Value = $PrimaryPublishingAgent; }) > $Null
 
                Line 1 "Site`t`t`t: " $Site.Name <>                 Line 1 "Site`t`t`t : " $Site.Name
                Line 1 "Primary Publishing Agent: " $PrimaryPublishingAgent                   Line 1 "Primary Connection Broker: " $PrimaryPublishingAgent
                Line 1 "Type`t`t`t: " $Type                   Line 1 "Type`t`t`t : " $Type
                Line 1 "State`t`t`t: " $State                   Line 1 "State`t`t`t : " $State
                Line 1 "Description`t`t: " $Description                   Line 1 "Description`t`t : " $Description
                Line 1 "ID`t`t`t: " $ID                   Line 1 "ID`t`t`t : " $ID
                Line 1 "Last modification by`t: " $Site.AdminLastMod                   Line 1 "Last modification by`t : " $Site.AdminLastMod
                Line 1 "Modified on`t`t: " $Site.TimeLastMod.ToString()                   Line 1 "Modified on`t`t : " $Site.TimeLastMod.ToString()
                Line 1 "Created by`t`t: " $Site.AdminCreate                   Line 1 "Created by`t`t : " $Site.AdminCreate
                Line 1 "Created on`t`t: " $Site.TimeCreate.ToString()                   Line 1 "Created on`t`t : " $Site.TimeCreate.ToString()
 
                $rowdata += @(,("Primary Publishing Agent",($Script:htmlsb),$PrimaryPublishingAgent,$htmlwhite)) <>                 $rowdata += @(,("Primary Connection Broker",($Script:htmlsb),$PrimaryPublishingAgent,$htmlwhite))
 
  -+                 "HyperVWin2022Std"                                      {$VDIType = "HyperV on Windows Server 2022 Standard Edition"; Break}
                    "HyperVWin2022Dtc"                                      {$VDIType = "HyperV on Windows Server 2022 Datacenter Edition"; Break}
 
  -+                 "HyperVFailoverClusterWin2022"          {$VDIType = "HyperV Failover Cluster on Windows Server 2022"; Break}
 
  <>                 "Nutanix5_5"                                            {$VDIType = "Nutanix 5.5"; Break}
                    "Nutanix5_10"                                           {$VDIType = "Nutanix 5.10"; Break}
                    "Nutanix5_15"                                           {$VDIType = "Nutanix 5.15"; Break}
                    "Nutanix5_20"                                           {$VDIType = "Nutanix 5.20"; Break}
                    "Nutanix6_5"                                            {$VDIType = "Nutanix 6.5"; Break}
                "RemotePCUnknown"                                       {$VDIType = "Remote PC Unknown"; Break}                   "RemotePCStaticUnknown"                         {$VDIType = "Remote PC static unknown"; Break}
 
  -+                 "RemotePCDynamicUnknown"                        {$VDIType = "Remote PC dynamic unknown"; Break}
 
  -+                 "Scale"                                                         {$VDIType = "Scale unknown"; Break}
 
  -+                 "Scale8_6_5"                                            {$VDIType = "Scale 8.6.5"; Break}
                    "Scale8_8"                                                      {$VDIType = "Scale 8.8"; Break}
                    "Scale8_9"                                                      {$VDIType = "Scale 8.9"; Break}
                    "Scale9_1"                                                      {$VDIType = "Scale 9.1"; Break}
 
  -+                 "AzureUnknown"                                          {$VDIType = "Azure"; Break}                                     
                    "AVD"                                                           {$VDIType = "AVD"; Break}                                       
                    "AWSEC2"                                                        {$VDIType = "AWSEC2"; Break}                                    
 
  -+                 #""                                             {$FullRASStatus = ""; Break}
                    "AddingMembers"                                 {$FullRASStatus = "Guest being added to the group"; Break}
 
  -+                 "DeleteInProgress"                              {$FullRASStatus = "A delete is currently in progress"; Break}
 
  -+                 "FailedPerfCounters"                    {$FullRASStatus = "Performance counters failed to initialize"; Break}
 
  -+                 "JoiningToGroup"                                {$FullRASStatus = "A host is current being joined to a group or hostpool"; Break}
 
  -+                 "NoAvailableGateways"                   {$FullRASStatus = "There are no RAS Secure Gateways that the Tenant Broker can use to process connections"; Break}
 
  -+                 "PendingRecreation"                             {$FullRASStatus = "Machine will be recreated on the last user logoff"; Break}
 
  -+                 "RemovingMembers"                               {$FullRASStatus = "Guest being removed from the group"; Break}
                    "ScalingIn"                                             {$FullRASStatus = "Deprecated: use RemovingMembers instead"; Break}
                    "ScalingOut"                                    {$FullRASStatus = "Deprecated: use AddingMembers instead"; Break}
 
                                Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)` <>                                 Unable to retrieve RDS Status for RDS Host $($RDSHost.Server)`
 
                                        WriteWordLine 0 0 "Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)" <>                                         WriteWordLine 0 0 "Unable to retrieve RDS Status for RDS Host $($RDSHost.Server)"
 
                                        Line 0 "Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)" <>                                         Line 0 "Unable to retrieve RDS Status for RDS Host $($RDSHost.Server)"
 
                                        WriteHTMLLine 0 0 "Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)" <>                                         WriteHTMLLine 0 0 "Unable to retrieve RDS Status for RDS Host $($RDSHost.Server)"
 
                                No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)` <>                                 No RDS Status retrieved for RDS Host $($RDSHost.Server)`
 
                                        WriteWordLine 0 0 "No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)" <>                                         WriteWordLine 0 0 "No RDS Status retrieved for RDS Host $($RDSHost.Server)"
 
                                        Line 0 "No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)" <>                                         Line 0 "No RDS Status retrieved for RDS Host $($RDSHost.Server)"
 
                                        WriteHTMLLine 0 0 "No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)" <>                                         WriteHTMLLine 0 0 "No RDS Status retrieved for RDS Host $($RDSHost.Server)"
 
                                        $ScriptInformation.Add(@{Data = "Preferred PA"; Value = $RDSStatus.PreferredPA; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Preferred Connection Broker"; Value = $RDSStatus.PreferredBroker; }) > $Null
 
                                        Line 2 "Address`t`t: " $RDSHost.Server <>                                         Line 2 "Address`t`t`t`t: " $RDSHost.Server
                                        Line 2 "Status`t`t: " $RDSStatusAgentState                                           Line 2 "Status`t`t`t`t: " $RDSStatusAgentState
                                        Line 2 "CPU`t`t: " "$($RDSStatus.CPULoad)%"                                           Line 2 "CPU`t`t`t`t: " "$($RDSStatus.CPULoad)%"
                                        Line 2 "RAM`t`t: " "$($RDSStatus.MemLoad)%"                                           Line 2 "RAM`t`t`t`t: " "$($RDSStatus.MemLoad)%"
                                        Line 2 "Disk read time`t: " "$($RDSStatus.DiskRead)%"                                           Line 2 "Disk read time`t`t`t: " "$($RDSStatus.DiskRead)%"
                                        Line 2 "Disk write time`t: " "$($RDSStatus.DiskWrite)%"                                           Line 2 "Disk write time`t`t`t: " "$($RDSStatus.DiskWrite)%"
                                        Line 2 "Sessions`t: " $Sessions                                           Line 2 "Sessions`t`t`t: " $Sessions
                                        Line 2 "Preferred PA`t: " $RDSStatus.PreferredPA                                           Line 2 "Preferred Connection Broker`t: " $RDSStatus.PreferredBroker
                                        Line 2 "Operating system: " $RDSStatus.ServerOS                                           Line 2 "Operating system`t`t: " $RDSStatus.ServerOS
                                        Line 2 "Agent version`t: " $RDSStatus.AgentVer                                           Line 2 "Agent version`t`t`t: " $RDSStatus.AgentVer
 
                                        $rowdata += @(,("Preferred PA",($Script:htmlsb),$RDSStatus.PreferredPA,$htmlwhite)) <>                                         $rowdata += @(,("Preferred Connection Broker",($Script:htmlsb),$RDSStatus.PreferredBroker,$htmlwhite))
 
        $VDIHosts = Get-RASProvider -SiteId $Site.Id -EA 0 4>$Null <>         $Providers = Get-RASProvider -SiteId $Site.Id -EA 0 4>$Null
 
                Unable to retrieve VDI for Site $($Site.Name)` <>                 Unable to retrieve Providers for Site $($Site.Name)`
 
                        WriteWordLine 0 0 "Unable to retrieve VDI for Site $($Site.Name)" <>                         WriteWordLine 0 0 "Unable to retrieve Providers for Site $($Site.Name)"
 
                        Line 0 "Unable to retrieve VDI for Site $($Site.Name)" <>                         Line 0 "Unable to retrieve Providers for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "Unable to retrieve VDI for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "Unable to retrieve Providers for Site $($Site.Name)"
 
        ElseIf($? -and $Null -eq $VDIHosts) <>         ElseIf($? -and $Null -eq $Providers)
 
                No VDI retrieved for Site $($Site.Name).` <>                 No Providers retrieved for Site $($Site.Name).`
 
                        WriteWordLine 0 0 "No VDI retrieved for Site $($Site.Name)" <>                         WriteWordLine 0 0 "No Providers retrieved for Site $($Site.Name)"
 
                        Line 0 "No VDI retrieved for Site $($Site.Name)" <>                         Line 0 "No Providers retrieved for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "No VDI retrieved for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "No Providers retrieved for Site $($Site.Name)"
 
                        WriteWordLine 2 0 "VDI Providers" <>                         WriteWordLine 2 0 "Providers"
 
                        Line 1 "VDI Providers" <>                         Line 1 "Providers"
 
                        WriteHTMLLine 2 0 "VDI Providers" <>                         WriteHTMLLine 2 0 "Providers"
 
                Write-Verbose "$(Get-Date -Format G): `t`tOutput VDI Providers" <>                 Write-Verbose "$(Get-Date -Format G): `t`tOutput Providers"
                ForEach($VDIHost in $VDIHosts)                   ForEach($Provider in $Providers)
 
                        $VDIHostStatus = Get-RASProviderStatus -Id $VDIHost.Id -EA 0 4>$Null <>                         $Providerstatus = Get-RASProviderStatus -Id $Provider.Id -EA 0 4>$Null
 
                                Unable to retrieve VDI Host Status for VDI Host $($VDIHost.Id)` <>                                 Unable to retrieve VDI Host Status for VDI Host $($Provider.Id)`
 
                                        WriteWordLine 0 0 "Unable to retrieve VDI Host Status for VDI Host $($VDIHost.Id)" <>                                         WriteWordLine 0 0 "Unable to retrieve VDI Host Status for VDI Host $($Provider.Id)"
 
                                        Line 0 "Unable to retrieve VDI Host Status for VDI Host $($VDIHost.Id)" <>                                         Line 0 "Unable to retrieve VDI Host Status for VDI Host $($Provider.Id)"
 
                                        WriteHTMLLine 0 0 "Unable to retrieve VDI Host Status for VDI Host $($VDIHost.Id)" <>                                         WriteHTMLLine 0 0 "Unable to retrieve VDI Host Status for VDI Host $($Provider.Id)"
 
                        ElseIf($? -and $Null -eq $VDIHostStatus) <>                         ElseIf($? -and $Null -eq $Providerstatus)
 
                                No VDI Host Status retrieved for VDI Host $($VDIHost.Id)` <>                                 No VDI Host Status retrieved for VDI Host $($Provider.Id)`
 
                                        WriteWordLine 0 0 "No VDI Host Status retrieved for VDI Host $($VDIHost.Id)" <>                                         WriteWordLine 0 0 "No VDI Host Status retrieved for VDI Host $($Provider.Id)"
 
                                        Line 0 "No VDI Host Status retrieved for VDI Host $($VDIHost.Id)" <>                                         Line 0 "No VDI Host Status retrieved for VDI Host $($Provider.Id)"
 
                                        WriteHTMLLine 0 0 "No VDI Host Status retrieved for VDI Host $($VDIHost.Id)" <>                                         WriteHTMLLine 0 0 "No VDI Host Status retrieved for VDI Host $($Provider.Id)"
 
                                $FullProviderStatus = GetRASStatus $VDIHostStatus.AgentState <>                                 $FullProviderStatus = GetRASStatus $Providerstatus.AgentState
 
                                        $ScriptInformation.Add(@{Data = "Address"; Value = $VDIHost.Server; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Address"; Value = $Provider.Server; }) > $Null
 
                                        $ScriptInformation.Add(@{Data = "CPU"; Value = "$($VDIHostStatus.CPULoad)%"; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "CPU"; Value = "$($Providerstatus.CPULoad)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "RAM"; Value = "$($VDIHostStatus.MemLoad)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "RAM"; Value = "$($Providerstatus.MemLoad)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Disk read time"; Value = "$($VDIHostStatus.DiskRead)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "Disk read time"; Value = "$($Providerstatus.DiskRead)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Disk write time"; Value = "$($VDIHostStatus.DiskWrite)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "Disk write time"; Value = "$($Providerstatus.DiskWrite)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Preferred PA"; Value = $VDIHostStatus.PreferredPA; }) > $Null                                           $ScriptInformation.Add(@{Data = "Preferred COnnection Broker"; Value = $Providerstatus.PreferredBroker; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Operating system"; Value = $VDIHostStatus.ServerOS; }) > $Null                                           $ScriptInformation.Add(@{Data = "Operating system"; Value = $Providerstatus.ServerOS; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Agent version"; Value = $VDIHostStatus.AgentVer; }) > $Null                                           $ScriptInformation.Add(@{Data = "Agent version"; Value = $Providerstatus.AgentVer; }) > $Null
 
                                        Line 2 "Address`t`t: " $VDIHost.Server <>                                         Line 2 "Address`t`t`t`t: " $Provider.Server
                                        Line 2 "Status`t`t: " $FullProviderStatus                                           Line 2 "Status`t`t`t`t: " $FullProviderStatus
                                        Line 2 "CPU`t`t: " "$($VDIHostStatus.CPULoad)%"                                           Line 2 "CPU`t`t`t`t: " "$($Providerstatus.CPULoad)%"
                                        Line 2 "RAM`t`t: " "$($VDIHostStatus.MemLoad)%"                                           Line 2 "RAM`t`t`t`t: " "$($Providerstatus.MemLoad)%"
                                        Line 2 "Disk read time`t: " "$($VDIHostStatus.DiskRead)%"                                           Line 2 "Disk read time`t`t`t: " "$($Providerstatus.DiskRead)%"
                                        Line 2 "Disk write time`t: " "$($VDIHostStatus.DiskWrite)%"                                           Line 2 "Disk write time`t`t`t: " "$($Providerstatus.DiskWrite)%"
                                        Line 2 "Preferred PA`t: " $VDIHostStatus.PreferredPA                                           Line 2 "Preferred Connection Broker`t: " $Providerstatus.PreferredBroker
                                        Line 2 "Operating system: " $VDIHostStatus.ServerOS                                           Line 2 "Operating system`t`t: " $Providerstatus.ServerOS
                                        Line 2 "Agent version`t: " $VDIHostStatus.AgentVer                                           Line 2 "Agent version`t`t`t: " $Providerstatus.AgentVer
 
                                        $columnHeaders = @("Address",($Script:htmlsb),$VDIHost.Server,$htmlwhite) <>                                         $columnHeaders = @("Address",($Script:htmlsb),$Provider.Server,$htmlwhite)
 
                                        $rowdata += @(,("CPU",($Script:htmlsb),"$($VDIHostStatus.CPULoad)%",$htmlwhite)) <>                                         $rowdata += @(,("CPU",($Script:htmlsb),"$($Providerstatus.CPULoad)%",$htmlwhite))
                                        $rowdata += @(,("RAM",($Script:htmlsb),"$($VDIHostStatus.MemLoad)%",$htmlwhite))                                           $rowdata += @(,("RAM",($Script:htmlsb),"$($Providerstatus.MemLoad)%",$htmlwhite))
                                        $rowdata += @(,("Disk read time",($Script:htmlsb),"$($VDIHostStatus.DiskRead)%",$htmlwhite))                                           $rowdata += @(,("Disk read time",($Script:htmlsb),"$($Providerstatus.DiskRead)%",$htmlwhite))
                                        $rowdata += @(,("Disk write time",($Script:htmlsb),"$($VDIHostStatus.DiskWrite)%",$htmlwhite))                                           $rowdata += @(,("Disk write time",($Script:htmlsb),"$($Providerstatus.DiskWrite)%",$htmlwhite))
                                        $rowdata += @(,("Preferred PA",($Script:htmlsb),$VDIHostStatus.PreferredPA,$htmlwhite))                                           $rowdata += @(,("Preferred Connection Broker",($Script:htmlsb),$Providerstatus.PreferredBroker,$htmlwhite))
                                        $rowdata += @(,("Operating system",($Script:htmlsb),$VDIHostStatus.ServerOS,$htmlwhite))                                           $rowdata += @(,("Operating system",($Script:htmlsb),$Providerstatus.ServerOS,$htmlwhite))
                                        $rowdata += @(,("Agent version",($Script:htmlsb),$VDIHostStatus.AgentVer,$htmlwhite))                                           $rowdata += @(,("Agent version",($Script:htmlsb),$Providerstatus.AgentVer,$htmlwhite))
 
        $GWs = Get-RASGW -Siteid $Site.Id -EA 0 4> $Null <>         $SecureGateways = Get-RASGateway -Siteid $Site.Id -EA 0 4> $Null
 
                Unable to retrieve Gateways for Site $($Site.Name)` <>                 Unable to retrieve Secure Gateways for Site $($Site.Name)`
 
                        WriteWordLine 0 0 "Unable to retrieve Gateways for Site $($Site.Name)" <>                         WriteWordLine 0 0 "Unable to retrieve Secure Gateways for Site $($Site.Name)"
 
                        Line 0 "Unable to retrieve Gateways for Site $($Site.Name)" <>                         Line 0 "Unable to retrieve Secure Gateways for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "Unable to retrieve Gateways for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "Unable to retrieve Secure Gateways for Site $($Site.Name)"
 
        ElseIf($? -and $Null -eq $GWs) <>         ElseIf($? -and $Null -eq $SecureGateways)
 
                No Gateways retrieved for Site $($Site.Name).` <>                 No Secure Gateways retrieved for Site $($Site.Name).`
 
                        WriteWordLine 0 0 "No Gateways retrieved for Site $($Site.Name)" <>                         WriteWordLine 0 0 "No Secure Gateways retrieved for Site $($Site.Name)"
 
                        Line 0 "No Gateways retrieved for Site $($Site.Name)" <>                         Line 0 "No Secure Gateways retrieved for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "No Gateways retrieved for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "No Secure Gateways retrieved for Site $($Site.Name)"
 
                        WriteWordLine 2 0 "Gateways" <>                         WriteWordLine 2 0 "Secure Gateways"
 
                        Line 1 "Gateways" <>                         Line 1 "Secure Gateways"
 
                        WriteHTMLLine 2 0 "Gateways" <>                         WriteHTMLLine 2 0 "Secure Gateways"
 
                Write-Verbose "$(Get-Date -Format G): `t`tOutput Site Gateways" <>                 Write-Verbose "$(Get-Date -Format G): `t`tOutput Site Secure Gateways"
                ForEach($GW in $GWs)                   ForEach($SecureGateway in $SecureGateways)
 
                        $GWStatus = Get-RASGWStatus -Id $GW.Id -EA 0 4>$Null <>                         $SecureGatewayStatus = Get-RASGatewayStatus -Id $SecureGateway.Id -EA 0 4>$Null
 
                                Unable to retrieve Gateway Status for Gateway $($GW.Id)` <>                                 Unable to retrieve Gateway Status for Secure Gateway $($SecureGateway.Id)`
 
                                        WriteWordLine 0 0 "Unable to retrieve Gateway Status for Gateway $($GW.Id)" <>                                         WriteWordLine 0 0 "Unable to retrieve Gateway Status for Secure Gateway $($SecureGateway.Id)"
 
                                        Line 0 "Unable to retrieve Gateway Status for Gateway $($GW.Id)" <>                                         Line 0 "Unable to retrieve Gateway Status for Secure Gateway $($SecureGateway.Id)"
 
                                        WriteHTMLLine 0 0 "Unable to retrieve Gateway Status for Gateway $($GW.Id)" <>                                         WriteHTMLLine 0 0 "Unable to retrieve Gateway Status for Secure Gateway $($SecureGateway.Id)"
 
                        ElseIf($? -and $Null -eq $GWStatus) <>                         ElseIf($? -and $Null -eq $SecureGatewayStatus)
 
                                No Gateway Status retrieved for Gateway $($GW.Id)` <>                                 No Gateway Status retrieved for Secure Gateway $($SecureGateway.Id)`
 
                                        WriteWordLine 0 0 "No Gateway Status retrieved for Gateway $($GW.Id)" <>                                         WriteWordLine 0 0 "No Gateway Status retrieved for Secure Gateway $($SecureGateway.Id)"
 
                                        Line 0 "No Gateway Status retrieved for Gateway $($GW.Id)" <>                                         Line 0 "No Gateway Status retrieved for Secure Gateway $($SecureGateway.Id)"
 
                                        WriteHTMLLine 0 0 "No Gateway Status retrieved for Gateway $($GW.Id)" <>                                         WriteHTMLLine 0 0 "No Gateway Status retrieved for Secure Gateway $($SecureGateway.Id)"
 
                                $Sessions = ($GWStatus.ActiveRDPSessions + $GWStatus.ActiveRDPSSLSessions) <>                                 $Sessions = ($SecureGatewayStatus.ActiveRDPSessions + $SecureGatewayStatus.ActiveRDPSSLSessions)
                                $GWStatusAgentState = GetRASStatus $GWStatus.AgentState                                   $SecureGatewayStatusAgentState = GetRASStatus $SecureGatewayStatus.AgentState
 
                                        $ScriptInformation.Add(@{Data = "Address"; Value = $GW.Server; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Address"; Value = $SecureGateway.Server; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Status"; Value = $GWStatusAgentState; }) > $Null                                           $ScriptInformation.Add(@{Data = "Status"; Value = $SecureGatewayStatusAgentState; }) > $Null
                                        $ScriptInformation.Add(@{Data = "CPU"; Value = "$($GWStatus.CPULoad)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "CPU"; Value = "$($SecureGatewayStatus.CPULoad)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "RAM"; Value = "$($GWStatus.MemLoad)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "RAM"; Value = "$($SecureGatewayStatus.MemLoad)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Disk read time"; Value = "$($GWStatus.DiskRead)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "Disk read time"; Value = "$($SecureGatewayStatus.DiskRead)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Disk write time"; Value = "$($GWStatus.DiskWrite)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "Disk write time"; Value = "$($SecureGatewayStatus.DiskWrite)%"; }) > $Null
 
                                        $ScriptInformation.Add(@{Data = "Preferred PA"; Value = $GWStatus.PreferredPA; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Preferred Connection Broker"; Value = $SecureGatewayStatus.PreferredBroker; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Operating system"; Value = $GWStatus.ServerOS; }) > $Null                                           $ScriptInformation.Add(@{Data = "Operating system"; Value = $SecureGatewayStatus.ServerOS; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Agent version"; Value = $GWStatus.AgentVer; }) > $Null                                           $ScriptInformation.Add(@{Data = "Agent version"; Value = $SecureGatewayStatus.AgentVer; }) > $Null
 
                                        Line 2 "Address`t`t: " $GW.Server <>                                         Line 2 "Address`t`t`t`t: " $SecureGateway.Server
                                        Line 2 "Status`t`t: " $GWStatusAgentState                                           Line 2 "Status`t`t`t`t: " $SecureGatewayStatusAgentState
                                        Line 2 "CPU`t`t: " "$($GWStatus.CPULoad)%"                                           Line 2 "CPU`t`t`t`t: " "$($SecureGatewayStatus.CPULoad)%"
                                        Line 2 "RAM`t`t: " "$($GWStatus.MemLoad)%"                                           Line 2 "RAM`t`t`t`t: " "$($SecureGatewayStatus.MemLoad)%"
                                        Line 2 "Disk read time`t: " "$($GWStatus.DiskRead)%"                                           Line 2 "Disk read time`t`t`t: " "$($SecureGatewayStatus.DiskRead)%"
                                        Line 2 "Disk write time`t: " "$($GWStatus.DiskWrite)%"                                           Line 2 "Disk write time`t`t`t: " "$($SecureGatewayStatus.DiskWrite)%"
                                        Line 2 "Sessions`t: " $Sessions.ToString()                                           Line 2 "Sessions`t`t`t: " $Sessions.ToString()
                                        Line 2 "Preferred PA`t: " $GWStatus.PreferredPA                                           Line 2 "Preferred Connection Broker`t: " $SecureGatewayStatus.PreferredBroker
                                        Line 2 "Operating system: " $GWStatus.ServerOS                                           Line 2 "Operating system`t`t: " $SecureGatewayStatus.ServerOS
                                        Line 2 "Agent version`t: " $GWStatus.AgentVer                                           Line 2 "Agent version`t`t`t: " $SecureGatewayStatus.AgentVer
 
                                        $columnHeaders = @("Address",($Script:htmlsb),$GW.Server,$htmlwhite) <>                                         $columnHeaders = @("Address",($Script:htmlsb),$SecureGateway.Server,$htmlwhite)
                                        $rowdata += @(,("Status",($Script:htmlsb),$GWStatusAgentState.ToString(),$htmlwhite))                                           $rowdata += @(,("Status",($Script:htmlsb),$SecureGatewayStatusAgentState.ToString(),$htmlwhite))
                                        $rowdata += @(,("CPU",($Script:htmlsb),"$($GWStatus.CPULoad)%",$htmlwhite))                                           $rowdata += @(,("CPU",($Script:htmlsb),"$($SecureGatewayStatus.CPULoad)%",$htmlwhite))
                                        $rowdata += @(,("RAM",($Script:htmlsb),"$($GWStatus.MemLoad)%",$htmlwhite))                                           $rowdata += @(,("RAM",($Script:htmlsb),"$($SecureGatewayStatus.MemLoad)%",$htmlwhite))
                                        $rowdata += @(,("Disk read time",($Script:htmlsb),"$($GWStatus.DiskRead)%",$htmlwhite))                                           $rowdata += @(,("Disk read time",($Script:htmlsb),"$($SecureGatewayStatus.DiskRead)%",$htmlwhite))
                                        $rowdata += @(,("Disk write time",($Script:htmlsb),"$($GWStatus.DiskWrite)%",$htmlwhite))                                           $rowdata += @(,("Disk write time",($Script:htmlsb),"$($SecureGatewayStatus.DiskWrite)%",$htmlwhite))
 
                                        $rowdata += @(,("Preferred PA",($Script:htmlsb),$GWStatus.PreferredPA,$htmlwhite)) <>                                         $rowdata += @(,("Preferred Connection Broker",($Script:htmlsb),$SecureGatewayStatus.PreferredBroker,$htmlwhite))
                                        $rowdata += @(,("Operating system",($Script:htmlsb),$GWStatus.ServerOS,$htmlwhite))                                           $rowdata += @(,("Operating system",($Script:htmlsb),$SecureGatewayStatus.ServerOS,$htmlwhite))
                                        $rowdata += @(,("Agent version",($Script:htmlsb),$GWStatus.AgentVer,$htmlwhite))                                           $rowdata += @(,("Agent version",($Script:htmlsb),$SecureGatewayStatus.AgentVer,$htmlwhite))
 
        $PAs = Get-RASPA -Siteid $Site.Id -EA 0 4> $Null <>         $ConnectionBrokers = Get-RASBroker -Siteid $Site.Id -EA 0 4> $Null
 
                Unable to retrieve Publishing Agents for Site $($Site.Name)` <>                 Unable to retrieve Connection Brokers for Site $($Site.Name)`
 
                        WriteWordLine 0 0 "Unable to retrieve Publishing Agents for Site $($Site.Name)" <>                         WriteWordLine 0 0 "Unable to retrieve Connection Brokers for Site $($Site.Name)"
 
                        Line 0 "Unable to retrieve Publishing Agents for Site $($Site.Name)" <>                         Line 0 "Unable to retrieve Connection Brokers for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "Unable to retrieve Publishing Agents for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "Unable to retrieve Connection Brokers for Site $($Site.Name)"
 
        ElseIf($? -and $Null -eq $PAs) <>         ElseIf($? -and $Null -eq $ConnectionBrokers)
 
                No Publishing Agents retrieved for Site $($Site.Name).` <>                 No Connection Brokers retrieved for Site $($Site.Name).`
 
                        WriteWordLine 0 0 "No Publishing Agents retrieved for Site $($Site.Name)" <>                         WriteWordLine 0 0 "No Connection Brokers retrieved for Site $($Site.Name)"
 
                        Line 0 "No Publishing Agents retrieved for Site $($Site.Name)" <>                         Line 0 "No Connection Brokers retrieved for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "No Publishing Agents retrieved for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "No Connection Brokers retrieved for Site $($Site.Name)"
 
                        WriteWordLine 2 0 "Publishing Agents" <>                         WriteWordLine 2 0 "Connection Brokers"
 
                        Line 1 "Publishing Agents" <>                         Line 1 "Connection Brokers"
 
                        WriteHTMLLine 2 0 "Publishing Agents" <>                         WriteHTMLLine 2 0 "Connection Brokers"
 
                Write-Verbose "$(Get-Date -Format G): `t`tOutput Publishing Agents" <>                 Write-Verbose "$(Get-Date -Format G): `t`tOutput Connection Brokers"
                ForEach($PA in $PAs)                   ForEach($ConnectionBroker in $ConnectionBrokers)
 
                        $PAStatus = Get-RASPAStatus -Id $PA.Id -EA 0 4>$Null <>                         $ConnectionBrokerStatus = Get-RASBrokerStatus -Id $ConnectionBroker.Id -EA 0 4>$Null
 
                                Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)` <>                                 Unable to retrieve Connection Brokers Status for Connection Brokers $($ConnectionBroker.Id)`
 
                                        WriteWordLine 0 0 "Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)" <>                                         WriteWordLine 0 0 "Unable to retrieve Connection Brokers Status for Connection Brokers $($ConnectionBroker.Id)"
 
                                        Line 0 "Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)" <>                                         Line 0 "Unable to retrieve Connection Brokers Status for Connection Brokers $($ConnectionBroker.Id)"
 
                                        WriteHTMLLine 0 0 "Unable to retrieve Publishing Agents Status for Publishing Agents $($PA.Id)" <>                                         WriteHTMLLine 0 0 "Unable to retrieve Connection Brokers Status for Connection Brokers $($ConnectionBroker.Id)"
 
                        ElseIf($? -and $Null -eq $PAStatus) <>                         ElseIf($? -and $Null -eq $ConnectionBrokerStatus)
 
                                No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)` <>                                 No Connection Brokers Status retrieved for Connection Brokers $($ConnectionBroker.Id)`
 
                                        WriteWordLine 0 0 "No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)" <>                                         WriteWordLine 0 0 "No Connection Brokers Status retrieved for Connection Brokers $($ConnectionBroker.Id)"
 
                                        Line 0 "No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)" <>                                         Line 0 "No Connection Brokers Status retrieved for Connection Brokers $($ConnectionBroker.Id)"
 
                                        WriteHTMLLine 0 0 "No Publishing Agents Status retrieved for Publishing Agents $($PA.Id)" <>                                         WriteHTMLLine 0 0 "No Connection Brokers Status retrieved for Connection Brokers $($ConnectionBroker.Id)"
 
                                $PAStatusAgentState = GetRASStatus $PAStatus.AgentState <>                                 $ConnectionBrokerStatusAgentState = GetRASStatus $ConnectionBrokerStatus.AgentState
 
                                        $ScriptInformation.Add(@{Data = "Address"; Value = $PA.Server; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Address"; Value = $ConnectionBroker.Server; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Status"; Value = $PAStatusAgentState; }) > $Null                                           $ScriptInformation.Add(@{Data = "Status"; Value = $ConnectionBrokerStatusAgentState; }) > $Null
                                        $ScriptInformation.Add(@{Data = "CPU"; Value = "$($PAStatus.CPULoad)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "CPU"; Value = "$($ConnectionBrokerStatus.CPULoad)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "RAM"; Value = "$($PAStatus.MemLoad)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "RAM"; Value = "$($ConnectionBrokerStatus.MemLoad)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Disk read time"; Value = "$($PAStatus.DiskRead)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "Disk read time"; Value = "$($ConnectionBrokerStatus.DiskRead)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Disk write time"; Value = "$($PAStatus.DiskWrite)%"; }) > $Null                                           $ScriptInformation.Add(@{Data = "Disk write time"; Value = "$($ConnectionBrokerStatus.DiskWrite)%"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Operating system"; Value = $PAStatus.ServerOS; }) > $Null                                           $ScriptInformation.Add(@{Data = "Operating system"; Value = $ConnectionBrokerStatus.ServerOS; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Agent version"; Value = $PAStatus.AgentVer; }) > $Null                                           $ScriptInformation.Add(@{Data = "Agent version"; Value = $ConnectionBrokerStatus.AgentVer; }) > $Null
 
                                        Line 2 "Address`t`t: " $PA.Server <>                                         Line 2 "Address`t`t: " $ConnectionBroker.Server
                                        Line 2 "Status`t`t: " $PAStatusAgentState                                           Line 2 "Status`t`t: " $ConnectionBrokerStatusAgentState
                                        Line 2 "CPU`t`t: " "$($PAStatus.CPULoad)%"                                           Line 2 "CPU`t`t: " "$($ConnectionBrokerStatus.CPULoad)%"
                                        Line 2 "RAM`t`t: " "$($PAStatus.MemLoad)%"                                           Line 2 "RAM`t`t: " "$($ConnectionBrokerStatus.MemLoad)%"
                                        Line 2 "Disk read time`t: " "$($PAStatus.DiskRead)%"                                           Line 2 "Disk read time`t: " "$($ConnectionBrokerStatus.DiskRead)%"
                                        Line 2 "Disk write time`t: " "$($PAStatus.DiskWrite)%"                                           Line 2 "Disk write time`t: " "$($ConnectionBrokerStatus.DiskWrite)%"
                                        Line 2 "Operating system: " $PAStatus.ServerOS                                           Line 2 "Operating system: " $ConnectionBrokerStatus.ServerOS
                                        Line 2 "Agent version`t: " $PAStatus.AgentVer                                           Line 2 "Agent version`t: " $ConnectionBrokerStatus.AgentVer
 
                                        $columnHeaders = @("Address",($Script:htmlsb),$PA.Server,$htmlwhite) <>                                         $columnHeaders = @("Address",($Script:htmlsb),$ConnectionBroker.Server,$htmlwhite)
                                        $rowdata += @(,("Status",($Script:htmlsb),$PAStatusAgentState.ToString(),$htmlwhite))                                           $rowdata += @(,("Status",($Script:htmlsb),$ConnectionBrokerStatusAgentState.ToString(),$htmlwhite))
                                        $rowdata += @(,("CPU",($Script:htmlsb),"$($PAStatus.CPULoad)%",$htmlwhite))                                           $rowdata += @(,("CPU",($Script:htmlsb),"$($ConnectionBrokerStatus.CPULoad)%",$htmlwhite))
                                        $rowdata += @(,("RAM",($Script:htmlsb),"$($PAStatus.MemLoad)%",$htmlwhite))                                           $rowdata += @(,("RAM",($Script:htmlsb),"$($ConnectionBrokerStatus.MemLoad)%",$htmlwhite))
                                        $rowdata += @(,("Disk read time",($Script:htmlsb),"$($PAStatus.DiskRead)%",$htmlwhite))                                           $rowdata += @(,("Disk read time",($Script:htmlsb),"$($ConnectionBrokerStatus.DiskRead)%",$htmlwhite))
                                        $rowdata += @(,("Disk write time",($Script:htmlsb),"$($PAStatus.DiskWrite)%",$htmlwhite))                                           $rowdata += @(,("Disk write time",($Script:htmlsb),"$($ConnectionBrokerStatus.DiskWrite)%",$htmlwhite))
                                        $rowdata += @(,("Operating system",($Script:htmlsb),$PAStatus.ServerOS,$htmlwhite))                                           $rowdata += @(,("Operating system",($Script:htmlsb),$ConnectionBrokerStatus.ServerOS,$htmlwhite))
                                        $rowdata += @(,("Agent version",($Script:htmlsb),$PAStatus.AgentVer,$htmlwhite))                                           $rowdata += @(,("Agent version",($Script:htmlsb),$ConnectionBrokerStatus.AgentVer,$htmlwhite))
 
                                $Status      = "N/A" +-  
 
                                                                "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled"; Break} <>                                                                 "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                                     Break}
                                                                "Disbaled"                                              {$RDSAllowClientURLMailRedirection = "Disabled"; Break}                                                                   "Disabled"                                              {$RDSAllowClientURLMailRedirection = "Disabled";
                                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                                     Break}
                                                                "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled (Replace Registered Application)"; Break}                                                                   "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                                     $ReplaceRegisteredApplication = "True";
                                                                                                                                     Break}
                                                                Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($GroupDefaults.AllowURLAndMailRedirection)"; Break}                                                                   Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($GroupDefaults.AllowURLAndMailRedirection)";
                                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                                     Break}
 
                                                                "Bidirectional"         {$RDSDragAndDrop = "Bidirectional"; Break} <>                                                                 "Bidirectional"         {$RDSDragAndDrop = "Bidirectional";
                                                                    $RDSAllowDragAndDrop = "True";
                                                                    Break}
                                                                "Disabled"                      {$RDSDragAndDrop = "Disabled"; Break}                                                                   "Disabled"                      {$RDSDragAndDrop = "Disabled";
                                                                    $RDSAllowDragAndDrop = "False";
                                                                    Break}
                                                                "ClientToServer"        {$RDSDragAndDrop = "Client to server only"; Break}                                                                   "ClientToServer"        {$RDSDragAndDrop = "Client to server only";
                                                                    $RDSAllowDragAndDrop = "True";
                                                                    Break}
                                                                "ServerToClient"        {$RDSDragAndDrop = "Server to client only"; Break}                                                                   "ServerToClient"        {$RDSDragAndDrop = "Server to client only";
                                                                    $RDSAllowDragAndDrop = "True";
                                                                    Break}
                                                                Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($GroupDefaults.DragAndDropMode)"; Break}                                                                   Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($GroupDefaults.DragAndDropMode)";
                                                                    $RDSAllowDragAndDrop = "False";
                                                                    Break}
 
                                                        If($GroupDefaults.PreferredPAId -eq 0) <>                                                         If($GroupDefaults.PreferredBrokerId -eq 0)
 
                                                                $RDSPreferredPublishingAgent = (Get-RASPA -Id $GroupDefaults.PreferredPAId -EA 0 4>$Null).Server <>                                                                 $RDSPreferredPublishingAgent = (Get-RASBroker -Id $GroupDefaults.PreferredBrokerId -EA 0 4>$Null).Server
 
                                                                        "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled"; Break} <>                                                                         "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                                                             Break}
                                                                        "Disbaled"                                              {$RDSAllowClientURLMailRedirection = "Disabled"; Break}                                                                           "Disabled"                                              {$RDSAllowClientURLMailRedirection = "Disabled";
                                                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                                                             Break}
                                                                        "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled (Replace Registered Application)"; Break}                                                                           "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                                             $ReplaceRegisteredApplication = "True";
                                                                                                                                             Break}
                                                                        Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSDefaults.AllowURLAndMailRedirection)"; Break}                                                                           Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSDefaults.AllowURLAndMailRedirection)";
                                                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                                                             Break}
 
                                                                        "Bidirectional"         {$RDSDragAndDrop = "Bidirectional"; Break} <>                                                                         "Bidirectional"         {$RDSDragAndDrop = "Bidirectional";
                                                                            $RDSAllowDragAndDrop = "True";
                                                                            Break}
                                                                        "Disabled"                      {$RDSDragAndDrop = "Disabled"; Break}                                                                           "Disabled"                      {$RDSDragAndDrop = "Disabled";
                                                                            $RDSAllowDragAndDrop = "False";
                                                                            Break}
                                                                        "ClientToServer"        {$RDSDragAndDrop = "Client to server only"; Break}                                                                           "ClientToServer"        {$RDSDragAndDrop = "Client to server only";
                                                                            $RDSAllowDragAndDrop = "True";
                                                                            Break}
                                                                        "ServerToClient"        {$RDSDragAndDrop = "Server to client only"; Break}                                                                           "ServerToClient"        {$RDSDragAndDrop = "Server to client only";
                                                                            $RDSAllowDragAndDrop = "True";
                                                                            Break}
                                                                        Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSDefaults.DragAndDropMode)"; Break}                                                                           Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSDefaults.DragAndDropMode)";
                                                                            $RDSAllowDragAndDrop = "False";
                                                                            Break}
 
                                                                If($RDSDefaults.PreferredPAId -eq 0) <>                                                                 If($RDSDefaults.PreferredBrokerId -eq 0)
 
                                                                        $RDSPreferredPublishingAgent = (Get-RASPA -Id $RDSDefaults.PreferredPAId -EA 0 4>$Null).Server <>                                                                         $RDSPreferredPublishingAgent = (Get-RASBroker -Id $RDSDefaults.PreferredBrokerId -EA 0 4>$Null).Server
 
  -+                                                                 $ReplaceRegisteredApplication          = "False"
 
  -+                                                                 $RDSAllowDragAndDrop                   = "Enabled"
 
                                                "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled"; Break} <>                                                 "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                     Break}
                                                "Disbaled"                                              {$RDSAllowClientURLMailRedirection = "Disabled"; Break}                                                   "Disabled"                                              {$RDSAllowClientURLMailRedirection = "Disabled";
                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                     Break}
                                                "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled (Replace Registered Application)"; Break}                                                   "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                     $ReplaceRegisteredApplication = "True";
                                                                                                                     Break}
                                                Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSHost.AllowURLAndMailRedirection)"; Break}                                                   Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSHost.AllowURLAndMailRedirection)";
                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                     Break}
 
                                                "Bidirectional"         {$RDSDragAndDrop = "Bidirectional"; Break} <>                                                 "Bidirectional"         {$RDSDragAndDrop = "Bidirectional";
                                                    $RDSAllowDragAndDrop = "True";
                                                    Break}
                                                "Disabled"                      {$RDSDragAndDrop = "Disabled"; Break}                                                   "Disabled"                      {$RDSDragAndDrop = "Disabled";
                                                    $RDSAllowDragAndDrop = "False";
                                                    Break}
                                                "ClientToServer"        {$RDSDragAndDrop = "Client to server only"; Break}                                                   "ClientToServer"        {$RDSDragAndDrop = "Client to server only";
                                                    $RDSAllowDragAndDrop = "True";
                                                    Break}
                                                "ServerToClient"        {$RDSDragAndDrop = "Server to client only"; Break}                                                   "ServerToClient"        {$RDSDragAndDrop = "Server to client only";
                                                    $RDSAllowDragAndDrop = "True";
                                                    Break}
                                                Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSHost.DragAndDropMode)"; Break}                                                   Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSHost.DragAndDropMode)";
                                                    $RDSAllowDragAndDrop = "False";
                                                    Break}
 
                                        If($RDSHost.PreferredPAId -eq 0) <>                                         If($RDSHost.PreferredBrokerId -eq 0)
 
                                                $RDSPreferredPublishingAgent = (Get-RASPA -Id $RDSHost.PreferredPAId -EA 0 4>$Null).Server <>                                                 $RDSPreferredPublishingAgent = (Get-RASBroker -Id $RDSHost.PreferredBrokerId -EA 0 4>$Null).Server
 
                                        "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled"; Break} <>                                         "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
                                        "Disbaled"                                              {$RDSAllowClientURLMailRedirection = "Disabled"; Break}                                           "Disabled"                                              {$RDSAllowClientURLMailRedirection = "Disabled";
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
                                        "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled (Replace Registered Application)"; Break}                                           "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                             $ReplaceRegisteredApplication = "True";
                                                                                                             Break}
                                        Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSHost.AllowURLAndMailRedirection)"; Break}                                           Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSHost.AllowURLAndMailRedirection)";
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
 
                                        "Bidirectional"         {$RDSDragAndDrop = "Bidirectional"; Break} <>                                         "Bidirectional"         {$RDSDragAndDrop = "Bidirectional";
                                            $RDSAllowDragAndDrop = "True";
                                            Break}
                                        "Disabled"                      {$RDSDragAndDrop = "Disabled"; Break}                                           "Disabled"                      {$RDSDragAndDrop = "Disabled";
                                            $RDSAllowDragAndDrop = "False";
                                            Break}
                                        "ClientToServer"        {$RDSDragAndDrop = "Client to server only"; Break}                                           "ClientToServer"        {$RDSDragAndDrop = "Client to server only";
                                            $RDSAllowDragAndDrop = "True";
                                            Break}
                                        "ServerToClient"        {$RDSDragAndDrop = "Server to client only"; Break}                                           "ServerToClient"        {$RDSDragAndDrop = "Server to client only";
                                            $RDSAllowDragAndDrop = "True";
                                            Break}
                                        Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSHost.DragAndDropMode)"; Break}                                           Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSHost.DragAndDropMode)";
                                            $RDSAllowDragAndDrop = "False";
                                            Break}
 
                                If($RDSHost.PreferredPAId -eq 0) <>                                 If($RDSHost.PreferredBrokerId -eq 0)
 
                                        $RDSPreferredPublishingAgent = (Get-RASPA -Id $RDSHost.PreferredPAId -EA 0 4>$Null).Server <>                                         $RDSPreferredPublishingAgent = (Get-RASBroker -Id $RDSHost.PreferredBrokerId -EA 0 4>$Null).Server
 
  <>                                 $ScriptInformation.Add(@{Data = "Application session lingering"; Value = ""; }) > $Null
                                    $ScriptInformation.Add(@{Data = "     Disconnect active session after"; Value = $RDSPublishingSessionDisconnectTimeout; }) > $Null
                                    $ScriptInformation.Add(@{Data = "     Logoff disconnected session after"; Value = $RDSPublishingSessionResetTime; }) > $Null
                                    $ScriptInformation.Add(@{Data = "Other settings"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "Port"; Value = $RDSPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Port"; Value = $RDSPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "Max Sessions"; Value = $RDSMaxSessions; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Max Sessions"; Value = $RDSMaxSessions; }) > $Null
                                $ScriptInformation.Add(@{Data = "Publishing Session Disconnect Timeout"; Value = $RDSPublishingSessionDisconnectTimeout; }) > $Null    
                                $ScriptInformation.Add(@{Data = "Publishing Session Reset Timeout"; Value = $RDSPublishingSessionResetTime; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Preferred Connection Broker"; Value = $RDSPreferredPublishingAgent; }) > $Null
 
  <>                                 $ScriptInformation.Add(@{Data = "     Replace registered application"; Value = $ReplaceRegisteredApplication; }) > $Null
                                $ScriptInformation.Add(@{Data = "Support Windows Shell URL namespace objects"; Value = $RDSSupportShellURLNamespaceObject; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Support Windows Shell URL namespace objects"; Value = $RDSSupportShellURLNamespaceObject; }) > $Null
                                $ScriptInformation.Add(@{Data = "Drag and drop"; Value = $RDSDragAndDrop; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable Drag and drop"; Value = $RDSAllowDragandDrop; }) > $Null
                                $ScriptInformation.Add(@{Data = "Preferred Publishing Agent"; Value = $RDSPreferredPublishingAgent; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Direction"; Value = $RDSDragAndDrop; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "Allow file transfer command (HTML5 and Chrome clients)"; Value = $RDSAllowFileTransfer; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Allow file transfer command (Web (HTML5) and Chrome clients)"; Value = $RDSAllowFileTransfer; }) > $Null
                                $ScriptInformation.Add(@{Data = "Configure File Transfer"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Configure File Transfer"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Direction"; Value = $RDSFileTransferMode; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Direction"; Value = $RDSFileTransferMode; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Location"; Value = $RDSFileTransferLocation; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Location"; Value = $RDSFileTransferLocation; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Do not allow to change location"; Value = $RDSFileTransferChangeLocation; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Do not allow to change location"; Value = $RDSFileTransferChangeLocation; }) > $Null
 
                                Line 4 "Inherit default settings`t`t`t`t: " $RDSHost.InheritDefaultAgentSettings.ToString() <>                                 Line 4 "Inherit default settings`t`t`t`t`t: " $RDSHost.InheritDefaultAgentSettings.ToString()
                                    Line 4 "Application session lingering"
                                    Line 5 "Disconnect active session after`t`t`t`t: " $RDSPublishingSessionDisconnectTimeout
                                    Line 5 "Logoff disconnected session after`t`t`t: " $RDSPublishingSessionResetTime
                                    Line 4 "Other settings"
                                Line 4 "Port`t`t`t`t`t`t`t: " $RDSPort                                   Line 5 "Port`t`t`t`t`t`t`t: " $RDSPort
                                Line 4 "Max Sessions`t`t`t`t`t`t: " $RDSMaxSessions                                   Line 5 "Max Sessions`t`t`t`t`t`t: " $RDSMaxSessions
                                Line 4 "Publishing Session Disconnect Timeout`t`t`t: " $RDSPublishingSessionDisconnectTimeout    
                                Line 4 "Publishing Session Reset Timeout`t`t`t: " $RDSPublishingSessionResetTime                                   Line 5 "Preferred Connection Broker`t`t`t`t: " $RDSPreferredPublishingAgent
                                Line 4 "Allow Client URL/Mail Redirection`t`t`t: " $RDSAllowClientURLMailRedirection                                   Line 4 "Allow Client URL/Mail Redirection`t`t`t`t: " $RDSAllowClientURLMailRedirection
                                    Line 5 "Replace registered application`t`t`t`t: " $ReplaceRegisteredApplication
                                Line 4 "Support Windows Shell URL namespace objects`t`t: " $RDSSupportShellURLNamespaceObject                                   Line 5 "Support Windows Shell URL namespace objects`t`t: " $RDSSupportShellURLNamespaceObject
                                Line 4 "Drag and drop`t`t`t`t`t`t: " $RDSDragAndDrop                                   Line 4 "Enable Drag and drop`t`t`t`t`t`t: " $RDSAllowDragandDrop
                                Line 4 "Preferred Publishing Agent`t`t`t`t: " $RDSPreferredPublishingAgent                                   Line 5 "Direction`t`t`t`t`t`t: " $RDSDragAndDrop
                                Line 4 "Allow 2xRemoteExec to send command to the client`t: " $RDSAllowRemoteExec                                   Line 4 "Allow 2xRemoteExec to send command to the client`t`t: " $RDSAllowRemoteExec
                                Line 4 "Use RemoteApp if available`t`t`t`t: " $RDSUseRemoteApps                                   Line 4 "Use RemoteApp if available`t`t`t`t`t: " $RDSUseRemoteApps
                                Line 4 "Enable applications monitoring`t`t`t`t: " $RDSEnableAppMonitoring                                   Line 4 "Enable applications monitoring`t`t`t`t`t: " $RDSEnableAppMonitoring
                                Line 4 "Allow file transfer command (HTML5 and Chrome clients)`t: " $RDSAllowFileTransfer                                   Line 4 "Allow file transfer command (Web (HTML5) and Chrome clients)`t: " $RDSAllowFileTransfer
                                Line 4 "Configure File Transfer"                                   Line 5 "Configure File Transfer"
                                Line 5 "Direction`t`t`t: " $RDSFileTransferMode                                   Line 6 "Direction`t`t`t: " $RDSFileTransferMode
                                Line 5 "Location`t`t`t: " $RDSFileTransferLocation                                   Line 6 "Location`t`t`t: " $RDSFileTransferLocation
                                Line 5 "Do not allow to change location`t: " $RDSFileTransferChangeLocation                                   Line 6 "Do not allow to change location : " $RDSFileTransferChangeLocation
                                Line 4 "Enable drive redirection cache`t`t`t`t: " $RDSEnableDriveRedirectionCache                                   Line 4 "Enable drive redirection cache`t`t`t`t`t: " $RDSEnableDriveRedirectionCache
 
  <>                                 $rowdata += @(,("Application session lingering",($Script:htmlsb),"",$htmlwhite))
                                    $rowdata += @(,("     Disconnect active session after",($Script:htmlsb),$RDSPublishingSessionDisconnectTimeout,$htmlwhite))
                                    $rowdata += @(,("     Logoff disconnected session after",($Script:htmlsb),$RDSPublishingSessionResetTime,$htmlwhite))
                                    $rowdata += @(,("Other settings",($Script:htmlsb),$RDSPort,$htmlwhite))
                                $rowdata += @(,("Port",($Script:htmlsb),$RDSPort,$htmlwhite))                                   $rowdata += @(,("     Port",($Script:htmlsb),$RDSPort,$htmlwhite))
                                $rowdata += @(,("Max Sessions",($Script:htmlsb),$RDSMaxSessions,$htmlwhite))                                   $rowdata += @(,("     Max Sessions",($Script:htmlsb),$RDSMaxSessions,$htmlwhite))
                                $rowdata += @(,("Publishing Session Disconnect Timeout",($Script:htmlsb),$RDSPublishingSessionDisconnectTimeout,$htmlwhite))    
                                $rowdata += @(,("Publishing Session Reset Timeout",($Script:htmlsb),$RDSPublishingSessionResetTime,$htmlwhite))                                   $rowdata += @(,("     Preferred Connection Broker",($Script:htmlsb),$RDSPreferredPublishingAgent,$htmlwhite))
 
  <>                                 $rowdata += @(,("     Replace registered application",($Script:htmlsb),$ReplaceRegisteredApplication,$htmlwhite))
                                $rowdata += @(,("Support Windows Shell URL namespace objects",($Script:htmlsb),$RDSSupportShellURLNamespaceObject,$htmlwhite))                                   $rowdata += @(,("     Support Windows Shell URL namespace objects",($Script:htmlsb),$RDSSupportShellURLNamespaceObject,$htmlwhite))
                                $rowdata += @(,("Drag and drop",($Script:htmlsb),$RDSDragAndDrop,$htmlwhite))                                   $rowdata += @(,("Enable Drag and drop",($Script:htmlsb),$RDSAllowDragandDrop,$htmlwhite))
                                $rowdata += @(,("Preferred Publishing Agent",($Script:htmlsb),$RDSPreferredPublishingAgent,$htmlwhite))                                   $rowdata += @(,("     Direction",($Script:htmlsb),$RDSDragAndDrop,$htmlwhite))
 
                                $rowdata += @(,("Allow file transfer command (HTML5 and Chrome clients)",($Script:htmlsb),$RDSAllowFileTransfer,$htmlwhite)) <>                                 $rowdata += @(,("Allow file transfer command (Web (HTML5) and Chrome clients)",($Script:htmlsb),$RDSAllowFileTransfer,$htmlwhite))
                                $rowdata += @(,("Configure File Transfer",($Script:htmlsb),"",$htmlwhite))                                   $rowdata += @(,("     Configure File Transfer",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,("     Direction",($Script:htmlsb),$RDSFileTransferMode,$htmlwhite))                                   $rowdata += @(,("          Direction",($Script:htmlsb),$RDSFileTransferMode,$htmlwhite))
                                $rowdata += @(,("     Location",($Script:htmlsb),$RDSFileTransferLocation,$htmlwhite))                                   $rowdata += @(,("          Location",($Script:htmlsb),$RDSFileTransferLocation,$htmlwhite))
                                $rowdata += @(,("     Do not allow to change location",($Script:htmlsb),$RDSFileTransferChangeLocation,$htmlwhite))                                   $rowdata += @(,("          Do not allow to change location",($Script:htmlsb),$RDSFileTransferChangeLocation,$htmlwhite))
 
                        #Desktop Access <>                         #Optimization
 
                                WriteWordLine 4 0 "Desktop access" <>                                 WriteWordLine 4 0 "Optimization"
 
                                Line 3 "Desktop access" <>                                 Line 3 "Optimization"
 
                         <>  
                            <#
                            Get-RASImageOptimization -Id 1 -ObjType RDS
     
                            EnableOptimization            : True
                            OptimizationType              : Automatic
                            WindowsDefenderATP            : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.WindowsDefenderATP
                            WindowsComponents             : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.WindowsComponents
                            WindowsDefenderATPEnabled     : True
                            WindowsComponentsEnabled      : True
                            WindowsServicesEnabled        : True
                            WindowsScheduledTasksEnabled  : True
                            WindowsAdvancedOptionsEnabled : True
                            NetworkPerformanceEnabled     : True
                            RegistryEnabled               : True
                            VisualEffectsEnabled          : True
                            DiskCleanupEnabled            : True
                            CustomScriptEnabled           : False
                            WindowsServices               : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.WindowsServices
                            WindowsAdvancedOptions        : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.WindowsAdvancedOptions
                            NetworkPerformance            : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.NetworkPerformance
                            CustomScript                  : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.CustomScript
                            DiskCleanup                   : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.DiskCleanup
                            VisualEffects                 : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.VisualEffects
                            WindowsScheduledTasks         : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.WindowsScheduledTasks
                            Registry                      : RASAdminEngine.Core.OutputModels.ImagesOptimization.Categories.Registries
                            #>
     
                        If($RDSHost.InheritDefaultDesktopAccessSettings)                           If($RDSHost.InheritDefaultOptimizationSettings)
 
                                $Results = Get-RASRDSGroup -SiteId $Site.Id -EA 0 4>$Null <>                                 $RDSGroup = Get-RASRDSGroup -SiteId $Site.Id -EA 0 4>$Null
 
                                If($? -and $Null -ne $Results) <>                                 If($? -and $Null -ne $RDSGroup)
 
                                        If($Results.RDSIds -Contains $RDSHost.Id ) <>                                         If($RDSGroup.RDSIds -Contains $RDSHost.Id )
 
                                                If($Results.InheritDefaultDesktopAccessSettings -eq $False) <>                                                 If($RDSGroup.InheritDefaultOptimizationSettings -eq $False)
 
                                                        $GroupDefaults = $Results.RDSDefSettings <>                                                         $OPTEnableOptimization            = $RDSGroup.Optimization.EnableOptimization.ToString()
                                                            $OPTOptimizationType              = $RDSGroup.Optimization.OptimizationType.ToString()
                                                        $RDSRestrictDesktopAccess = $GroupDefaults.RestrictDesktopAccess.ToString()                                                           $OPTWindowsDefenderATPEnabled     = $RDSGroup.Optimization.WindowsDefenderATPEnabled.ToString()    
                                                        $RDSRestrictedUsers       = @()                                                           $OPTWindowsComponentsEnabled      = $RDSGroup.Optimization.WindowsComponentsEnabled.ToString()
                                                                                                                  $OPTWindowsServicesEnabled        = $RDSGroup.Optimization.WindowsServicesEnabled.ToString()
                                                        ForEach($User in $GroupDefaults.RestrictedUsers)                                                           $OPTWinodwsScheduledTasksEnabled  = $RDSGroup.Optimization.WindowsScheduledTasksEnabled.ToString()
                                                        {                                                           $OPTWindowsAdvancedOptionsEnabled = $RDSGroup.Optimization.WindowsAdvancedOptionsEnabled.ToString()
                                                            $OPTNetworkPerformanceEnabled     = $RDSGroup.Optimization.NetworkPerformanceEnabled.ToString()
                                                                $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)                                                           $OPTRegistryEnabled               = $RDSGroup.Optimization.RegistryEnabled.ToString()
                                                                $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])                                                           $OPTVisualEffectsEnabled          = $RDSGroup.Optimization.VisualEffectsEnabled.ToString()   
                                                                                                                          $OPTDiskCleanupEnabled            = $RDSGroup.Optimization.DiskCleanupEnabled.ToString()
                                                                $RDSRestrictedUsers += $objUser.Value                                                           $OPTCustomScriptEnabled           = $RDSGroup.Optimization.CustomScriptEnabled.ToString()
                                                        }    
 
                                                                $RDSRestrictDesktopAccess = $RDSDefaults.RestrictDesktopAccess.ToString() <>                                                                 $OPTEnableOptimization            = $RDSDefaults.Optimization.EnableOptimization.ToString()
                                                                $RDSRestrictedUsers       = @()                                                                   $OPTOptimizationType              = $RDSDefaults.Optimization.OptimizationType.ToString()
                                                                                                                                  $OPTWindowsDefenderATPEnabled     = $RDSDefaults.Optimization.WindowsDefenderATPEnabled.ToString()    
                                                                ForEach($User in $RDSDefaults.RestrictedUsers)                                                                   $OPTWindowsComponentsEnabled      = $RDSDefaults.Optimization.WindowsComponentsEnabled.ToString()
                                                                {                                                                   $OPTWindowsServicesEnabled        = $RDSDefaults.Optimization.WindowsServicesEnabled.ToString()
                                                                    $OPTWinodwsScheduledTasksEnabled  = $RDSDefaults.Optimization.WindowsScheduledTasksEnabled.ToString()
                                                                    $OPTWindowsAdvancedOptionsEnabled = $RDSDefaults.Optimization.WindowsAdvancedOptionsEnabled.ToString()
                                                                    $OPTNetworkPerformanceEnabled     = $RDSDefaults.Optimization.NetworkPerformanceEnabled.ToString()
                                                                        $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)                                                                   $OPTRegistryEnabled               = $RDSDefaults.Optimization.RegistryEnabled.ToString()
                                                                    $OPTVisualEffectsEnabled          = $RDSDefaults.Optimization.VisualEffectsEnabled.ToString()   
                                                                    $OPTDiskCleanupEnabled            = $RDSDefaults.Optimization.DiskCleanupEnabled.ToString()
                                                                        $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])                                                                   $OPTCustomScriptEnabled           = $RDSDefaults.Optimization.CustomScriptEnabled.ToString()
                                                                            
                                                                        $RDSRestrictedUsers += $objUser.Value    
                                                                }    
 
  <>                                                                 $OPTEnableOptimization            = "False"
                                                                    $OPTOptimizationType              = ""
                                                                    $OPTWindowsDefenderATPEnabled     = "False"
                                                                    $OPTWindowsComponentsEnabled      = "False"
                                                                    $OPTWindowsServicesEnabled        = "False"
                                                                    $OPTWinodwsScheduledTasksEnabled  = "False"
                                                                    $OPTWindowsAdvancedOptionsEnabled = "False"
                                                                    $OPTNetworkPerformanceEnabled     = "False"
                                                                    $OPTRegistryEnabled               = "False"
                                                                    $OPTVisualEffectsEnabled          = "False"
                                                                    $OPTDiskCleanupEnabled            = "False"
                                                                $RDSRestrictDesktopAccess = "False"                                                                   $OPTCustomScriptEnabled           = "False"
                                                                $RDSRestrictedUsers       = @()    
 
                                        $RDSRestrictDesktopAccess = $RDSHost.RestrictDesktopAccess.ToString() +-  
                                        $RDSRestrictedUsers       = @()    
 
                                        ForEach($User in $RDSHost.RestrictedUsers) <>                                         $OPTEnableOptimization            = $RDSHost.Optimization.EnableOptimization.ToString()
                                        {                                           $OPTOptimizationType              = $RDSHost.Optimization.OptimizationType.ToString()
                                            $OPTWindowsDefenderATPEnabled     = $RDSHost.Optimization.WindowsDefenderATPEnabled.ToString()    
                                            $OPTWindowsComponentsEnabled      = $RDSHost.Optimization.WindowsComponentsEnabled.ToString()
                                            $OPTWindowsServicesEnabled        = $RDSHost.Optimization.WindowsServicesEnabled.ToString()
                                            $OPTWinodwsScheduledTasksEnabled  = $RDSHost.Optimization.WindowsScheduledTasksEnabled.ToString()
                                            $OPTWindowsAdvancedOptionsEnabled = $RDSHost.Optimization.WindowsAdvancedOptionsEnabled.ToString()
                                            $OPTNetworkPerformanceEnabled     = $RDSHost.Optimization.NetworkPerformanceEnabled.ToString()
                                                $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)                                           $OPTRegistryEnabled               = $RDSHost.Optimization.RegistryEnabled.ToString()
                                            $OPTVisualEffectsEnabled          = $RDSHost.Optimization.VisualEffectsEnabled.ToString()   
                                            $OPTDiskCleanupEnabled            = $RDSHost.Optimization.DiskCleanupEnabled.ToString()
                                                $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])                                           $OPTCustomScriptEnabled           = $RDSHost.Optimization.CustomScriptEnabled.ToString()
                                                    
                                                $RDSRestrictedUsers += $objUser.Value    
                                        }    
 
                                $RDSRestrictDesktopAccess = $RDSHost.RestrictDesktopAccess.ToString() +-  
                                $RDSRestrictedUsers       = @()    
 
                                ForEach($User in $RDSHost.RestrictedUsers) <>                                 $OPTEnableOptimization            = $RDSHost.Optimization.EnableOptimization.ToString()
                                {                                   $OPTOptimizationType              = $RDSHost.Optimization.OptimizationType.ToString()
                                    $OPTWindowsDefenderATPEnabled     = $RDSHost.Optimization.WindowsDefenderATPEnabled.ToString()    
                                    $OPTWindowsComponentsEnabled      = $RDSHost.Optimization.WindowsComponentsEnabled.ToString()
                                    $OPTWindowsServicesEnabled        = $RDSHost.Optimization.WindowsServicesEnabled.ToString()
                                    $OPTWinodwsScheduledTasksEnabled  = $RDSHost.Optimization.WindowsScheduledTasksEnabled.ToString()
                                    $OPTWindowsAdvancedOptionsEnabled = $RDSHost.Optimization.WindowsAdvancedOptionsEnabled.ToString()
                                    $OPTNetworkPerformanceEnabled     = $RDSHost.Optimization.NetworkPerformanceEnabled.ToString()
                                        $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)                                   $OPTRegistryEnabled               = $RDSHost.Optimization.RegistryEnabled.ToString()
                                    $OPTVisualEffectsEnabled          = $RDSHost.Optimization.VisualEffectsEnabled.ToString()   
                                    $OPTDiskCleanupEnabled            = $RDSHost.Optimization.DiskCleanupEnabled.ToString()
                                        $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])                                   $OPTCustomScriptEnabled           = $RDSHost.Optimization.CustomScriptEnabled.ToString()
                                            
                                        $RDSRestrictedUsers += $objUser.Value    
                                }                           }
                        }    
                                    
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $RDSHost.InheritDefaultDesktopAccessSettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $RDSHost.InheritDefaultUserProfileSettings.ToString(); }) > $Null
                                    $ScriptInformation.Add(@{Data = "Enable optimization:"; Value = $OPTEnableOptimization; }) > $Null
                                    $ScriptInformation.Add(@{Data = "Optimization type:"; Value = $OPTOptimizationType; }) > $Null
     
                                    $Table = AddWordTable -Hashtable $ScriptInformation `
                                    -Columns Data,Value `
                                    -List `
                                    -Format $wdTableGrid `
                                    -AutoFit $wdAutoFitFixed;
     
                                    #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                    SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                    $Table.Columns.Item(1).Width = 250;
                                    $Table.Columns.Item(2).Width = 250;
     
                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                    FindWordDocumentEnd
                                    $Table = $Null
                                    WriteWordLine 0 0 ""
     
                                    WriteWordLine 5 0 "Windows Defender ATP:" $OPTWindowsDefenderATPEnabled
                                    If($OPTWindowsDefenderATPEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Windows Defender ATP Optimizations"; Value = ""; }) > $Null
     
                                            If($RDSHost.Optimization.WindowsDefenderATP.WinDefATPTurnOffOn.ToString() -eq "TurnOffWindowsDefenderATP")
                                            {
                                                    $ScriptInformation.Add(@{Data = "     Turn off Windows Defender ATP (I use my own ATP solution)"; Value = ""; }) > $Null
                                            }
                                            Else
                                            {
                                $ScriptInformation.Add(@{Data = "Restrict direct desktop access to the following users"; Value = $RDSRestrictDesktopAccess; }) > $Null                                                   $ScriptInformation.Add(@{Data = "     Turn on Windows Defender ATP and set process and folder exclusions"; Value = ""; }) > $Null
                                                    $ScriptInformation.Add(@{Data = "     Disable real-time protection"; Value = $RDSHost.Optimization.WindowsDefenderATP.DisableRealTimeProtection.ToString(); }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null
                                                                                  
                                $cnt = -1                                                   $cnt = -1
                                ForEach($Item in $RDSRestrictedUsers)                                                   ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeFolders)
                                {                                                   {
                                        $cnt++                                                           $cnt++
                                        If($cnt -eq 0)                                                           If($cnt -eq 0)
                                        {                                                           {
                                                                    $ScriptInformation.Add(@{Data = "     Exclude files and folders"; Value = $item; }) > $Null
                                                            }
                                                            Else
                                                            {
                                                $ScriptInformation.Add(@{Data = "Users"; Value = $Item; }) > $Null                                                                   $ScriptInformation.Add(@{Data = ""; Value = $item; }) > $Null
                                        }                                                           }
                                                    }
     
                                                    $cnt = -1
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeProcesses)
                                                    {
                                                            $cnt++
                                                            If($cnt -eq 0)
                                                            {
                                                                    $ScriptInformation.Add(@{Data = "     Exclude processes"; Value = $item; }) > $Null
                                                            }
                                        Else                                                           Else
                                        {                                                           {
                                                $ScriptInformation.Add(@{Data = ""; Value = $Item; }) > $Null                                                                   $ScriptInformation.Add(@{Data = ""; Value = $item; }) > $Null
                                        }                                                           }
                                }                                                   }
                                                    
                                                    $cnt = -1
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeExtension)
                                                    {
                                                            $cnt++
                                                            If($cnt -eq 0)
                                                            {
                                                                    $ScriptInformation.Add(@{Data = "     Exclude extensions"; Value = $item; }) > $Null
                                                            }
                                                            Else
                                                            {
                                                                    $ScriptInformation.Add(@{Data = ""; Value = $item; }) > $Null
                                                            }
                                                    }
                                            }
 
                                $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                         $Table = AddWordTable -Hashtable $ScriptInformation `
                                -Columns Data,Value `                                           -Columns Data,Value `
                                -List `                                           -List `
                                -Format $wdTableGrid `                                           -Format $wdTableGrid `
                                -AutoFit $wdAutoFitFixed;                                           -AutoFit $wdAutoFitFixed;
 
                                SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                         #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                           SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                $Table.Columns.Item(1).Width = 250; <>                                         $Table.Columns.Item(1).Width = 250;
                                $Table.Columns.Item(2).Width = 250;                                           $Table.Columns.Item(2).Width = 250;
 
                                $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                         $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                FindWordDocumentEnd <>                                         FindWordDocumentEnd
                                $Table = $Null                                           $Table = $Null
                                WriteWordLine 0 0 ""                                           WriteWordLine 0 0 ""
                        }                                   }
     
                                    WriteWordLine 5 0 "Windows Components:" $OPTWindowsComponentsEnabled
                                    If($OPTWindowsComponentsEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Windows Components Optimizations"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = "Disable (remove) components:"; Value = ""; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 200;
                                            $Table.Columns.Item(2).Width = 15;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
     
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $OptimizationTable = @()
                    
                                            ForEach($item in $RDSHost.Optimization.WindowsComponents.WindowsComponentsList)
                                            {
                                                            If($Null -eq $item.DisplayName)
                                                            {
                                                                    $DisplayName = ""
                                                            }
                                                            Else
                                                            {
                                                                    $DisplayName = $item.DisplayName
                                                            }
                                                            If($Null -eq $item.ComponentName)
                                                            {
                                                                    $ComponentName = ""
                                                            }
                                                            Else
                                                            {
                                                                    $ComponentName = $item.ComponentName
                                                            }
                                                    $OptimizationTable += @{
                                                            DisplayName = $DisplayName
                                                            ComponentName = $ComponentName
                                                    }
                                            }
     
                                            If($OptimizationTable.Count -gt 0)
                                            {
                                                    $Table = AddWordTable -Hashtable $OptimizationTable `
                                                    -Columns DisplayName, ComponentName `
                                                    -Headers "Display name", "Component" `
                                                    -Format $wdTableGrid `
                                                    -AutoFit $wdAutoFitFixed;
     
                                                    SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                                    $Table.Columns.Item(1).Width = 200;
                                                    $Table.Columns.Item(2).Width = 200;
                                                    
                                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                                    FindWordDocumentEnd
                                                    $Table = $Null
                                                    WriteWordLine 0 0 ""
                                            }
                                    }
     
                                    WriteWordLine 5 0 "Windows Services: " $OPTWindowsServicesEnabled       
                                    If($OPTWindowsServicesEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Windows Services Optimizations"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = "Disable services:"; Value = ""; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 200;
                                            $Table.Columns.Item(2).Width = 15;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
     
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $OptimizationTable = @()
                    
                                            ForEach($item in $RDSHost.Optimization.WindowsServices.WindowsServicesList)
                                            {
                                                            If($Null -eq $item.DisplayName)
                                                            {
                                                                    $DisplayName = ""
                                                            }
                                                            Else
                                                            {
                                                                    $DisplayName = $item.DisplayName
                                                            }
                                                            If($Null -eq $item.ServiceName)
                                                            {
                                                                    $Service = ""
                                                            }
                                                            Else
                                                            {
                                                                    $Service = $item.ServiceName
                                                            }
                                                            If($Null -eq $item.Aliases)
                                                            {
                                                                    $Aliases = ""
                                                            }
                                                            Else
                                                            {
                                                                    $Aliases = $item.Aliases
                                                            }
                                                    $OptimizationTable += @{
                                                            DisplayName = $DisplayName
                                                            Service     = $Service
                                                            Aliases     = $Aliases
                                                    }
                                            }
     
                                            If($OptimizationTable.Count -gt 0)
                                            {
                                                    $Table = AddWordTable -Hashtable $OptimizationTable `
                                                    -Columns DisplayName, Service, Aliases `
                                                    -Headers "Display name", "Service", "Aliases" `
                                                    -Format $wdTableGrid `
                                                    -AutoFit $wdAutoFitFixed;
     
                                                    SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                                    $Table.Columns.Item(1).Width = 200;
                                                    $Table.Columns.Item(2).Width = 100;
                                                    $Table.Columns.Item(3).Width = 50;
                                                    
                                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                                    FindWordDocumentEnd
                                                    $Table = $Null
                                                    WriteWordLine 0 0 ""
                                            }
                                    }
                                    
                                    WriteWordLine 5 0 "Windows Scheduled Tasks: " $OPTWinodwsScheduledTasksEnabled 
                                    If($OPTWinodwsScheduledTasksEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Windows Scheduled Tasks Optimizations"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = "Disable tasks:"; Value = ""; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 200;
                                            $Table.Columns.Item(2).Width = 15;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
     
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $OptimizationTable = @()
                    
                                            ForEach($item in $RDSHost.Optimization.WindowsScheduledTasks.WindowsScheduledTasksList)
                                            {
                                                            If($Null -eq $item.Task)
                                                            {
                                                                    $Task = ""
                                                            }
                                                            Else
                                                            {
                                                                    $Task = $item.Task
                                                            }
                                                            If($Null -eq $item.Type)
                                                            {
                                                                    $Type = ""
                                                            }
                                                            Else
                                                            {
                                                                    $Type = $item.Type.ToString()
                                                            }
                                                            If($Null -eq $item.Location)
                                                            {
                                                                    $Location = ""
                                                            }
                                                            Else
                                                            {
                                                                    $Location = $item.Location
                                                            }
                                                    $OptimizationTable += @{
                                                            Task     = $Task
                                                            Type     = $Type
                                                            Location = $Location
                                                    }
                                            }
     
                                            If($OptimizationTable.Count -gt 0)
                                            {
                                                    $Table = AddWordTable -Hashtable $OptimizationTable `
                                                    -Columns Task, Type, Location `
                                                    -Headers "Task", "Type", "Location" `
                                                    -Format $wdTableGrid `
                                                    -AutoFit $wdAutoFitFixed;
     
                                                    SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                                    $Table.Columns.Item(1).Width = 200;
                                                    $Table.Columns.Item(2).Width = 50;
                                                    $Table.Columns.Item(3).Width = 250;
                                                    
                                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                                    FindWordDocumentEnd
                                                    $Table = $Null
                                                    WriteWordLine 0 0 ""
                                            }
                                    }
                                    
                                    WriteWordLine 5 0 "Windows advanced options: " $OPTWindowsAdvancedOptionsEnabled
                                    If($OPTWindowsAdvancedOptionsEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Windows Advanced Options"; Value = ""; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 200;
                                            $Table.Columns.Item(2).Width = 15;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
     
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $OptimizationTable = @()
                    
                                            $OptimizationTable += @{
                                                    Setting = "Disable Hibernate"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.Hibernate.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable Telemetry collection"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.TeleCollection.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable System Restore"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.SystemRestore.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable error reporting to send additional data"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.AdditionalErrorReport.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable Tiles"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.Tiles.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable Cortana digital assistant"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.Cortana.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Turn off Microsoft consumer experience"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.MicrosoftConsumerExperience.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Do not show Windows tips"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.WindowsTips.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Remove Common program groups from the Start Menu"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.CommonProgramGroups.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Partial Start Menu layout"
                                                    Enabled = $RDSHost.Optimization.WindowsAdvancedOptions.PartialStartMenu.ToString()
                                                    Value   = $RDSHost.Optimization.WindowsAdvancedOptions.PartialStartLayoutContent
                                            }
     
                                            If($OptimizationTable.Count -gt 0)
                                            {
                                                    $Table = AddWordTable -Hashtable $OptimizationTable `
                                                    -Columns Setting, Enabled, Value `
                                                    -Headers "Setting", "Enabled", "Value" `
                                                    -Format $wdTableGrid `
                                                    -AutoFit $wdAutoFitFixed;
     
                                                    SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                                    $Table.Columns.Item(1).Width = 275;
                                                    $Table.Columns.Item(2).Width = 50;
                                                    $Table.Columns.Item(3).Width = 175;
                                                    
                                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                                    FindWordDocumentEnd
                                                    $Table = $Null
                                                    WriteWordLine 0 0 ""
                                            }
                                    }
                                    
                                    WriteWordLine 5 0 "Network performance: " $OPTNetworkPerformanceEnabled
                                    If($OPTNetworkPerformanceEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Network Performance Optimizations"; Value = ""; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 200;
                                            $Table.Columns.Item(2).Width = 15;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
     
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $OptimizationTable = @()
                    
                                            $OptimizationTable += @{
                                                    Setting = "FileInfoCacheEntriesMax"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.FileInfoCacheEnable.ToString()
                                                    Value   = $RDSHost.Optimization.NetworkPerformance.FileInfoCache
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "DirectoryCacheEntriesMax"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.DirectoryCacheEnable.ToString()
                                                    Value   = $RDSHost.Optimization.NetworkPerformance.DirCacheMax
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "FileNotFoundCacheEntriesMax"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.FileNotFoundCacheEnable.ToString()
                                                    Value   = $RDSHost.Optimization.NetworkPerformance.FileNotFoundCache
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "DormantFileLimit"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.DormantFileLimitEnable.ToString()
                                                    Value   = $RDSHost.Optimization.NetworkPerformance.DormantFileLimit
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable TCP/IP Task Offload"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.DisableTCP.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable IPv6 Components"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.DisableIPv6CompEnable.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disable IPv6 to IPv4"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.DisableIPv6ToIPv4.ToString()
                                                    Value   = ""
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Disables isatap for IPv6"
                                                    Enabled = $RDSHost.Optimization.NetworkPerformance.DisableIsaTap.ToString()
                                                    Value   = ""
                                            }
     
                                            If($OptimizationTable.Count -gt 0)
                                            {
                                                    $Table = AddWordTable -Hashtable $OptimizationTable `
                                                    -Columns Setting, Enabled, Value `
                                                    -Headers "Setting", "Enabled", "Value" `
                                                    -Format $wdTableGrid `
                                                    -AutoFit $wdAutoFitFixed;
     
                                                    SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                                    $Table.Columns.Item(1).Width = 150;
                                                    $Table.Columns.Item(2).Width = 50;
                                                    $Table.Columns.Item(3).Width = 50;
                                                    
                                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                                    FindWordDocumentEnd
                                                    $Table = $Null
                                                    WriteWordLine 0 0 ""
                                            }
                                    }
     
                                    WriteWordLine 5 0 "Registry: " $OPTRegistryEnabled
                                    If($OPTRegistryEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Registry Optimizations"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null
     
                                            ForEach($item in $RDSHost.Optimization.Registry.RegistryList)
                                            {
                                                    $ScriptInformation.Add(@{Data = "Registry"; Value = $item.DisplayName; }) > $Null
                                                    $ScriptInformation.Add(@{Data = "Action"; Value = $item.Action; }) > $Null
                                                    $ScriptInformation.Add(@{Data = "Value"; Value = $item.RegistryName; }) > $Null
                                                    $ScriptInformation.Add(@{Data = "Type"; Value = $item.RegType; }) > $Null
                                                    $ScriptInformation.Add(@{Data = "Data"; Value = $item.DWORDValue; }) > $Null
                                                    $ScriptInformation.Add(@{Data = "Path"; Value = "$($item.HiveType)\$($item.Path)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null
                                            }
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 125;
                                            $Table.Columns.Item(2).Width = 375;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
                                    }
                                    
                                    WriteWordLine 5 0 "Visual Effects: " $OPTVisualEffectsEnabled
                                    If($OPTVisualEffectsEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Visual Effects Optimizations"; Value = ""; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 200;
                                            $Table.Columns.Item(2).Width = 15;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
     
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $OptimizationTable = @()
                    
                                            $OptimizationTable += @{
                                                    Setting = "Animate controls and elements inside windows"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.AnimateControlSelectElements.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Animate windows when minimizing and maximizing"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.AnimateWindowsWhenMinimizingMaximizing.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Animations in the taskbar"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.AnimateTaskbar.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Enable Peek"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.EnablePeek.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Fade or slide menus into view"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.FadeSlideMenus.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Fade or slide Tooltips into view"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.FadeSlideToolTips.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Fade out menu items after clicking"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.FadeOutMenuItems.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Save taskbar thumbnail previews"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.SaveTaskbarThumbnail.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Show shadows under mouse pointer"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.ShowShadowUnderMouse.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Show shadows under windows"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.ShadowUnderWindows.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Show thumbnails instead of icons"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.ThumbnailsInsteadOfIcons.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Show translucent selection rectangle"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.ShowTranslucentSelection.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Show window contents while dragging"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.ShowWindowsContentWhilstDragging.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Slide open combo boxes"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.SlideOpenComboBoxes.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Smooth edges of screen fonts"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.SmoothEdgesScreenFonts.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Smooth-scroll list boxes"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.SmoothScrollListBoxes.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Use drop shadows for icon labels on the desktop"
                                                    Enabled = $RDSHost.Optimization.VisualEffects.DropShadowsIcon.ToString()
                                            }
     
                                            If($OptimizationTable.Count -gt 0)
                                            {
                                                    $Table = AddWordTable -Hashtable $OptimizationTable `
                                                    -Columns Setting, Enabled `
                                                    -Headers "Setting", "Enabled" `
                                                    -Format $wdTableGrid `
                                                    -AutoFit $wdAutoFitFixed;
     
                                                    SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                                    $Table.Columns.Item(1).Width = 250;
                                                    $Table.Columns.Item(2).Width = 50;
                                                    
                                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                                    FindWordDocumentEnd
                                                    $Table = $Null
                                                    WriteWordLine 0 0 ""
                                            }
                                    }
                                    
                                    WriteWordLine 5 0 "Disk cleanup: " $OPTDiskCleanupEnabled
                                    If($OPTDiskCleanupEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Disk Cleanup Optimizations"; Value = ""; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 200;
                                            $Table.Columns.Item(2).Width = 15;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
     
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $OptimizationTable = @()
                    
                                            $OptimizationTable += @{
                                                    Setting = "Clean up redundant system files"
                                                    Enabled = $RDSHost.Optimization.DiskCleanup.CleanupSystemFiles.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Clean up the WinSxS Folder"
                                                    Enabled = $RDSHost.Optimization.DiskCleanup.CleanupWinSxSFolder.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Clean up temporary files and logs"
                                                    Enabled = $RDSHost.Optimization.DiskCleanup.CleanupTemporaryFileLogs.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Remove OneDrive"
                                                    Enabled = $RDSHost.Optimization.DiskCleanup.RemoveOneDrive.ToString()
                                            }
     
                                            $OptimizationTable += @{
                                                    Setting = "Delete users' profiles"
                                                    Enabled = $RDSHost.Optimization.DiskCleanup.DeleteUserProfiles.ToString()
                                            }
     
                                            If($OptimizationTable.Count -gt 0)
                                            {
                                                    $Table = AddWordTable -Hashtable $OptimizationTable `
                                                    -Columns Setting, Enabled `
                                                    -Headers "Setting", "Enabled" `
                                                    -Format $wdTableGrid `
                                                    -AutoFit $wdAutoFitFixed;
     
                                                    SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                                    $Table.Columns.Item(1).Width = 175;
                                                    $Table.Columns.Item(2).Width = 50;
                                                    
                                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                                    FindWordDocumentEnd
                                                    $Table = $Null
                                                    WriteWordLine 0 0 ""
                                            }
                                    }
     
                                    WriteWordLine 5 0 "Custom script: " $OPTCustomScriptEnabled
                                    If($OPTCustomScriptEnabled -eq "True")
                                    {
                                            $ScriptInformation = New-Object System.Collections.ArrayList
                                            $ScriptInformation.Add(@{Data = "Custom Script"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = "     Command"; Value = $RDSHost.Optimization.CustomScript.Command; }) > $Null
                                            $ScriptInformation.Add(@{Data = "     Arguments"; Value = $RDSHost.Optimization.CustomScript.Arguments; }) > $Null
                                            $ScriptInformation.Add(@{Data = "     Initial directory"; Value = $RDSHost.Optimization.CustomScript.InitDir; }) > $Null
                                            $ScriptInformation.Add(@{Data = "     Username"; Value = $RDSHost.Optimization.CustomScript.User; }) > $Null
     
                                            $Table = AddWordTable -Hashtable $ScriptInformation `
                                            -Columns Data,Value `
                                            -List `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            #SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 100;
                                            $Table.Columns.Item(2).Width = 200;
     
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
                                    }
                            }
                            If($Text)
                            {
                                    Line 4 "Inherit default settings`t`t`t`t: " $RDSHost.InheritDefaultOptimizationSettings.ToString()
                                    Line 4 "Enable optimization: " $OPTEnableOptimization
                                    Line 4 "Optimization type: " $OPTOptimizationType
                                    Line 4 "Category"
                                    
                                    Line 5 "Windows Defender ATP: " $OPTWindowsDefenderATPEnabled
                                    If($OPTWindowsDefenderATPEnabled -eq "True")
                                    {
                                            Line 6 "Windows Defender ATP Optimizations"
                                            <#
                                                    WinDefATPTurnOffOn        : TurnOnWindowsDefenderATP
                                                    DisableRealTimeProtection : False
                                                    ExcludeFolders            : {%ProgramData%\Parallels\RASLogs\, %ProgramFiles(x86)%\Parallels\,
                                                                                                            %ProgramFiles%\Parallels\, %WINDOWS%\system32\config\...}
                                                    ExcludeProcesses          : {csrss.exe, winlogon.exe, rdpclip.exe, rdpinit.exe...}
                                                    ExcludeExtension          : {.vhd, .vhdx}                                       
                                            #>
                                            If($RDSHost.Optimization.WindowsDefenderATP.WinDefATPTurnOffOn.ToString() -eq "TurnOffWindowsDefenderATP")
                                            {
                                                    Line 7 "Turn off Windows Defender ATP (I use my own ATP solution)"
                                            }
                                            Else
                                            {
                                                    Line 7 "Turn on Windows Defender ATP and set process and folder exclusions"
                                                    Line 7 "Disable real-time protection: " $RDSHost.Optimization.WindowsDefenderATP.DisableRealTimeProtection.ToString()
                                                    Line 0 ""
                                                    Line 7 "Exclude files and folders:"
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeFolders)
                                                    {
                                                            Line 8 $item
                                                    }
     
                                                    Line 7 "Exclude processes:"
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeProcesses)
                                                    {
                                                            Line 8 $item
                                                    }
                                                    
                                                    Line 7 "Exclude extensions:"
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeExtension)
                                                    {
                                                            Line 8 $item
                                                    }
                                            }
                                            
                                            Line 0 ""
                                    }
                                    
                                    Line 5 "Windows Components: " $OPTWindowsComponentsEnabled
                                    If($OPTWindowsComponentsEnabled -eq "True")
                                    {
                                            Line 6 "Windows Components Optimizations"
                                            Line 7 "Disable (remove) components:"
                                            Line 0 ""
                                            Line 7 "Display name                                        Component                                         "
                                            Line 7 "======================================================================================================"
                                            #               12345678901234567890123456789012345678901234567890SS12345678901234567890123456789012345678901234567890
                                            #               Printing-XPSServices-Features                       SMB 1.0/CIFS File sharing support component
                                            <#
                                                              Type ComponentName                 DisplayName Aliases
                                                              ---- -------------                 ----------- -------
                                                    Predefined MSRDC-Infrastructure
                                                    Predefined MediaPlayback
                                                    Predefined WindowsMediaPlayer
                                                    Predefined Printing-XPSServices-Features
                                                    Predefined SMB1Protocol
                                                    Predefined SearchEngine-Client-Package
                                                    Predefined Xps-Foundation-Xps-Viewer                                    
                                            #>
                                            ForEach($item in $RDSHost.Optimization.WindowsComponents.WindowsComponentsList)
                                            {
                                                    Line 7 ( "{0,-50}  {1,-50}" -f $item.DisplayName, $item.ComponentName)
                                            }
                                            Line 0 ""
                                    }
                                    
                                    Line 5 "Windows Services: " $OPTWindowsServicesEnabled       
                                    If($OPTWindowsServicesEnabled -eq "True")
                                    {
                                            Line 6 "Windows Services Optimizations"
                                            Line 7 "Disable services:"
                                            Line 0 ""
                                            Line 7 "Display name                                        Service                         Aliases             "
                                            Line 7 "========================================================================================================"
                                            #               12345678901234567890123456789012345678901234567890SS123456789012345678901234567890SS12345678901234567890
                                            #               Windows Media Player Network Sharing Service        TabletInputService              Superfecth
                                            <#
                                                              Type ServiceName        DisplayName Aliases
                                                              ---- -----------        ----------- -------
                                                    Predefined AJRouter
                                                    Predefined ALG
                                                    Predefined BTAGService
                                                    Predefined BthAvctpSvc
                                                    Predefined CscService
                                                    Predefined DOT3SVC
                                                    Predefined DPS
                                                    Predefined DiagTrack
                                                    Predefined EFS
                                                    Predefined FDResPub
                                                    Predefined MapsBroker
                                                    Predefined SSDPSRV
                                                    Predefined SensrSvc
                                                    Predefined SharedAccess
                                                    Predefined ShellHWDetection
                                                    Predefined StorSvc
                                                    Predefined Sysmain
                                                    Predefined Superfetch
                                                    Predefined TabletInputService
                                                    Predefined TapiSrv
                                                    Predefined Themes
                                                    Predefined WMPNetworkSvc
                                                    Predefined WbioSrvc
                                                    Predefined WdiSystemHost
                                                    Predefined WerSvc
                                                    Predefined bthserv
                                                    Predefined fdPHost
                                                    Predefined lfsvc
                                                    Predefined upnphost
                                                    Predefined wbengine
                                                    Predefined wisvc
                                                    Predefined wlidsvc                                      
                                            #>
                                            ForEach($item in $RDSHost.Optimization.WindowsServices.WindowsServicesList)
                                            {
                                                    Line 7 ( "{0,-50}  {1,-30}  {2,-20}" -f $item.DisplayName, $item.ServiceName, $item.Aliases)
                                            }
                                            Line 0 ""
                                    }
                                    
                                    Line 5 "Windows Scheduled Tasks: " $OPTWinodwsScheduledTasksEnabled 
                                    If($OPTWinodwsScheduledTasksEnabled -eq "True")
                                    {
                                            Line 6 "Windows Scheduled Tasks Optimizations"
                                            Line 7 "Disable tasks:"
                                            Line 0 ""
                                            Line 7 "Task                                                Type    Location                                          "
                                            Line 7 "=============================================================================================================="
                                            #               12345678901234567890123456789012345678901234567890SS123456SS12345678901234567890123456789012345678901234567890
                                            #               MNO Metadata Parser                                 Folder  \Microsoft\Windows\Mobile Broadband Accounts\
                                            <#
                                                    Task                Location                                        Type
                                                    ----                --------                                        ----
                                                    *                   \Microsoft\Windows\Application Experience     Folder
                                                    *                   \Microsoft\Windows\BitLocker                  Folder
                                                    CDSSync             \Microsoft\Windows\WlanSvc\                     Task
                                                    *                   \Microsoft\OneCore\DirectX                    Folder
                                                    GatherNetworkInfo   \Microsoft\Windows\NetTrace\                    Task
                                                    MNO Metadata Parser \Microsoft\Windows\Mobile Broadband Accounts\   Task
                                                    NotificationTask    \Microsoft\Windows\WwanSvc\                     Task
                                                    *                   \Microsoft\Office                             Folder
                                                    QueueReporting      \Microsoft\Windows\Windows Error Reporting\     Task
                                                    SR                  \Microsoft\Windows\SystemRestore\               Task
                                                    ScheduledDefrag     \Microsoft\Windows\Defrag\                      Task
                                                    Scheduled Start     \Microsoft\Windows\WindowsUpdate\               Task
                                                    *                   \Microsoft\Windows\Sysmain                    Folder
                                                    Tpm-HASCertRetr     \Microsoft\Windows\TPM\                         Task
                                                    Tpm-Maintenance     \Microsoft\Windows\TPM\                         Task
                                                    UninstallDeviceTask \Microsoft\Windows\Bluetooth\                   Task
                                                    UpdateLibrary       \Microsoft\Windows\Windows Media Sharing\       Task
                                                    *                   \Microsoft\Windows\Windows Defender           Folder
                                                    XblGameSaveTask     \Microsoft\XblGameSave\                         Task
                                                    sihpostreboot       \Microsoft\Windows\WindowsUpdate\               Task                                        
                                            #>
                                            ForEach($item in $RDSHost.Optimization.WindowsScheduledTasks.WindowsScheduledTasksList)
                                            {
                                                    Line 7 ( "{0,-50}  {1,-6}  {2,-50}" -f $item.Task, $item.Type.ToString(), $item.Location)
                                            }
                                            Line 0 ""
                                    }
     
                                    Line 5 "Windows advanced options: " $OPTWindowsAdvancedOptionsEnabled
                                    If($OPTWindowsAdvancedOptionsEnabled -eq "True")
                                    {
                                            Line 6 "Windows Advanced Options"
                                            Line 0 ""
                                            Line 7 "Setting                                           Enabled  Value                                             "
                                            Line 7 "============================================================================================================="
                                            #               123456789012345678901234567890123456789012345678SS1234567SS12345678901234567890123456789012345678901234567890
                                            #               Remove Common program groups from the start menu  False    SomeConfigFile.xml
                                            <#
                                                    PartialStartLayoutContent   : Configuration.xml
                                                    Hibernate                   : True
                                                    TeleCollection              : True
                                                    SystemRestore               : True
                                                    AdditionalErrorReport       : True
                                                    Tiles                       : True
                                                    Cortana                     : True
                                                    MicrosoftConsumerExperience : True
                                                    WindowsTips                 : True
                                                    CommonProgramGroups         : True
                                                    PartialStartMenu            : True
                                            #>
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Disable Hibernate", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.Hibernate.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Disable Telemetry collection", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.TeleCollection.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Disable System Restore", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.SystemRestore.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Disable error reporting to send additional data", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.AdditionalErrorReport.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Disable Tiles", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.Tiles.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Disable Cortana digital assistant", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.Cortana.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Turn off Microsoft consumer experience", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.MicrosoftConsumerExperience.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Do not show Windows tips", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.WindowsTips.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Remove Common program groups from the Start Menu", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.CommonProgramGroups.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-48}  {1,-7}  {2,-50}" -f `
                                            "Partial Start Menu layout", `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.PartialStartMenu.ToString(), `
                                            $RDSHost.Optimization.WindowsAdvancedOptions.PartialStartLayoutContent)
                                            
                                            Line 0 ""
                                    }
     
                                    Line 5 "Network performance: " $OPTNetworkPerformanceEnabled
                                    If($OPTNetworkPerformanceEnabled -eq "True")
                                    {
                                            Line 6 "Network Performance Optimizations"
                                            Line 0 ""
                                            Line 7 "Setting                      Enabled  Value"
                                            Line 7 "==========================================="
                                            #               123456789012345678901234567SS1234567SS12345
                                            #               FileNotFoundCacheEntriesMax  False    32768
                                            <#
                                                    DirCacheMax             : 4096
                                                    DormantFileLimit        : 256
                                                    FileNotFoundCache       : 32768
                                                    FileInfoCache           : 32768
                                                    FileInfoCacheEnable     : True
                                                    DirectoryCacheEnable    : True
                                                    FileNotFoundCacheEnable : True
                                                    DormantFileLimitEnable  : True
                                                    DisableTCP              : True
                                                    DisableIPv6CompEnable   : True
                                                    DisableIPv6ToIPv4       : True
                                                    DisableIsaTap           : True
                                            #>
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "FileInfoCacheEntriesMax", `
                                            $RDSHost.Optimization.NetworkPerformance.FileInfoCacheEnable.ToString(), `
                                            $RDSHost.Optimization.NetworkPerformance.FileInfoCache)
                                            
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "DirectoryCacheEntriesMax", `
                                            $RDSHost.Optimization.NetworkPerformance.DirectoryCacheEnable.ToString(), `
                                            $RDSHost.Optimization.NetworkPerformance.DirCacheMax)
                                            
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "FileNotFoundCacheEntriesMax", `
                                            $RDSHost.Optimization.NetworkPerformance.FileNotFoundCacheEnable.ToString(), `
                                            $RDSHost.Optimization.NetworkPerformance.FileNotFoundCache)
                                            
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "DormantFileLimit", `
                                            $RDSHost.Optimization.NetworkPerformance.DormantFileLimitEnable.ToString(), `
                                            $RDSHost.Optimization.NetworkPerformance.DormantFileLimit)
                                            
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "Disable TCP/IP Task Offload", `
                                            $RDSHost.Optimization.NetworkPerformance.DisableTCP.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "Disable IPv6 Components", `
                                            $RDSHost.Optimization.NetworkPerformance.DisableIPv6CompEnable.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "Disable IPv6 to IPv4", `
                                            $RDSHost.Optimization.NetworkPerformance.DisableIPv6ToIPv4.ToString(), `
                                            "")
                                            
                                            Line 7 ( "{0,-27}  {1,-7}  {2,-5}" -f `
                                            "Disables isatap for IPv6", `
                                            $RDSHost.Optimization.NetworkPerformance.DisableIsaTap.ToString(), `
                                            "")
                                            
                                            Line 0 ""
                                    }
     
                                    Line 5 "Registry: " $OPTRegistryEnabled
                                    If($OPTRegistryEnabled -eq "True")
                                    {
                                            Line 6 "Registry Optimizations"
                                            Line 0 ""
                                            #               123456789012345678901234567SS1234567SS12345
                                            #               FileNotFoundCacheEntriesMax  False    32768
                                            <#
                                                    Id           : 1
                                                    Action       : Modify
                                                    RegistryName : ServicesPipeTimeout
                                                    DWORDValue   : 18000
                                                    DisplayName  : Increase service startup timeouts
                                                    HiveType     : HKEY_LOCAL_MACHINE
                                                    Path         : System\CurrentControlSet\Control
                                                    RegType      : REG_DWORD
     
                                                    Id           : 2
                                                    Action       : Modify
                                                    RegistryName : TimeOutValue
                                                    DWORDValue   : 200
                                                    DisplayName  : Increase Disk I/O Timeout
                                                    HiveType     : HKEY_LOCAL_MACHINE
                                                    Path         : System\CurrentControlSet\Services\Disk
                                                    RegType      : REG_DWORD
                                            #>
                                            Line 7 "Registry                                  Action  Value                 Type           Data                  Path                                                        "
                                            Line 7 "========================================================================================================================================================================="
                                            #               1234567890123456789012345678901234567890SS123456SS12345678901234567890SS1234567890123SS12345678901234567890SS123456789012345678901234567890123456789012345678901234567890
                                            #               Increase service startup timeouts         Modify  99999999999999999999  REG_EXPAND_SZ  99999999999999999999  HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Disk
                                            ForEach($item in $RDSHost.Optimization.Registry.RegistryList)
                                            {
                                                    Line 7 ( "{0,-40}  {1,-6}  {2,-20}  {3,-13}  {4,-20}  {5,-60}" -f `
                                                    $item.DisplayName, $item.Action, $item.RegistryName, $item.RegType, $item.DWORDValue, "$($item.HiveType)\$($item.Path)")
                                            }
                                            Line 0 ""
                                    }
     
                                    Line 5 "Visual Effects: " $OPTVisualEffectsEnabled
                                    If($OPTVisualEffectsEnabled -eq "True")
                                    {
                                            Line 6 "Visual Effects Optimizations"
                                            Line 0 ""
                                            
                                            Switch ($RDSHost.Optimization.VisualEffects.VisualEffectsTypes)
                                            {
                                                    "LetWindowsChooseWhatsBest"     {$VisualEffectsType = "Let Windows choose what's best"; Break}
                                                    "AdjustForBestAppearnce"        {$VisualEffectsType = "Adjust for best appearance"; Break} #misspelled in the PoSH output and the docs
                                                    "AdjustForBestPerformance"      {$VisualEffectsType = "Adjust for best performance"; Break}
                                                    "Custom"                                        {$VisualEffectsType = "Custom"; Break}
                                                    Default                                         {$VisualEffectsType = "Unable to determine Visual Effects Optimization type: $($RDSHost.Optimization.VisualEffects.VisualEffectsTypes)"; Break}
                                            }
                                            Line 7 $VisualEffectsType
                                            Line 0 ""
                                            Line 7 "Setting                                             Enabled"
                                            Line 7 "==========================================================="
                                            #               12345678901234567890123456789012345678901234567890SS1234567
                                            #               Use drop shadows for icon labels on the desktop     False  
                                            <#
                                                    VisualEffectsTypes                     : Custom
                                                    AnimateControlSelectElements           : False
                                                    AnimateWindowsWhenMinimizingMaximizing : False
                                                    AnimateTaskbar                         : False
                                                    EnablePeek                             : False
                                                    FadeSlideMenus                         : False
                                                    FadeSlideToolTips                      : False
                                                    FadeOutMenuItems                       : False
                                                    SaveTaskbarThumbnail                   : False
                                                    ShowShadowUnderMouse                   : False
                                                    ShadowUnderWindows                     : False
                                                    ThumbnailsInsteadOfIcons               : False
                                                    ShowTranslucentSelection               : False
                                                    ShowWindowsContentWhilstDragging       : False
                                                    SlideOpenComboBoxes                    : False
                                                    SmoothEdgesScreenFonts                 : True
                                                    SmoothScrollListBoxes                  : False
                                                    DropShadowsIcon                        : False
                                            #>
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Animate controls and elements inside windows", `
                                            $RDSHost.Optimization.VisualEffects.AnimateControlSelectElements.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Animate windows when minimizing and maximizing", `
                                            $RDSHost.Optimization.VisualEffects.AnimateWindowsWhenMinimizingMaximizing.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Animations in the taskbar", `
                                            $RDSHost.Optimization.VisualEffects.AnimateTaskbar.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Enable Peek", `
                                            $RDSHost.Optimization.VisualEffects.EnablePeek.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Fade or slide menus into view", `
                                            $RDSHost.Optimization.VisualEffects.FadeSlideMenus.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Fade or slide Tooltips into view", `
                                            $RDSHost.Optimization.VisualEffects.FadeSlideToolTips.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Fade out menu items after clicking", `
                                            $RDSHost.Optimization.VisualEffects.FadeOutMenuItems.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Save taskbar thumbnail previews", `
                                            $RDSHost.Optimization.VisualEffects.SaveTaskbarThumbnail.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Show shadows under mouse pointer", `
                                            $RDSHost.Optimization.VisualEffects.ShowShadowUnderMouse.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Show shadows under windows", `
                                            $RDSHost.Optimization.VisualEffects.ShadowUnderWindows.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Show thumbnails instead of icons", `
                                            $RDSHost.Optimization.VisualEffects.ThumbnailsInsteadOfIcons.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Show translucent selection rectangle", `
                                            $RDSHost.Optimization.VisualEffects.ShowTranslucentSelection.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Show window contents while dragging", `
                                            $RDSHost.Optimization.VisualEffects.ShowWindowsContentWhilstDragging.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Slide open combo boxes", `
                                            $RDSHost.Optimization.VisualEffects.SlideOpenComboBoxes.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Smooth edges of screen fonts", `
                                            $RDSHost.Optimization.VisualEffects.SmoothEdgesScreenFonts.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Smooth-scroll list boxes", `
                                            $RDSHost.Optimization.VisualEffects.SmoothScrollListBoxes.ToString())
                                            
                                            Line 7 ( "{0,-50}  {1,-7}" -f `
                                            "Use drop shadows for icon labels on the desktop", `
                                            $RDSHost.Optimization.VisualEffects.DropShadowsIcon.ToString())
                                            
                                            Line 0 ""
                                    }
     
                                    Line 5 "Disk cleanup: " $OPTDiskCleanupEnabled
                                    If($OPTDiskCleanupEnabled -eq "True")
                                    {
                                            Line 6 "Disk Cleanup Optimizations"
                                            Line 0 ""
                                            
                                            Line 7 "Setting                            Enabled"
                                            Line 7 "=========================================="
                                            #               123456789012345678901234567890123SS1234567
                                            #               Clean up temporary files and logs  False  
                                            <#
                                                    CleanupWinSxSFolder      : False
                                                    CleanupSystemFiles       : False
                                                    CleanupTemporaryFileLogs : True
                                                    RemoveOneDrive           : False
                                                    DeleteUserProfiles       : False
                                            #>
                                            Line 7 ( "{0,-33}  {1,-7}" -f `
                                            "Clean up redundant system files", `
                                            $RDSHost.Optimization.DiskCleanup.CleanupSystemFiles.ToString())
                                            
                                            Line 7 ( "{0,-33}  {1,-7}" -f `
                                            "Clean up the WinSxS Folder", `
                                            $RDSHost.Optimization.DiskCleanup.CleanupWinSxSFolder.ToString())
                                            
                                            Line 7 ( "{0,-33}  {1,-7}" -f `
                                            "Clean up temporary files and logs", `
                                            $RDSHost.Optimization.DiskCleanup.CleanupTemporaryFileLogs.ToString())
                                            
                                            Line 7 ( "{0,-33}  {1,-7}" -f `
                                            "Remove OneDrive", `
                                            $RDSHost.Optimization.DiskCleanup.RemoveOneDrive.ToString())
                                            
                                            Line 7 ( "{0,-33}  {1,-7}" -f `
                                            "Delete users' profiles", `
                                            $RDSHost.Optimization.DiskCleanup.DeleteUserProfiles.ToString())
                                            
                                            Line 0 ""
                                    }
     
                                    Line 5 "Custom script: " $OPTCustomScriptEnabled
                                    If($OPTCustomScriptEnabled  -eq "True")
                                    {
                                            Line 6 "Custom Script"
                                            Line 0 ""
                                            
                                            <#
                                                    Arguments : CustomScriptArguments
                                                    Command   : CustomScriptCommand
                                                    InitDir   : CustomScriptInitialDirectory
                                                    User      : CustomScriptUsername
                                            #>
                                            Line 7 "Command`t`t : " $RDSHost.Optimization.CustomScript.Command
                                            Line 7 "Arguments`t : " $RDSHost.Optimization.CustomScript.Arguments
                                            Line 7 "Initial directory: " $RDSHost.Optimization.CustomScript.InitDir
                                            Line 7 "Username`t : " $RDSHost.Optimization.CustomScript.User
                                            Line 0 ""
                                    }
                                    Line 0 ""
                            }
                            If($HTML)
                            {
                                    $rowdata = @()
                                    $columnHeaders = @("Inherit default settings:",($Script:htmlsb),$RDSHost.InheritDefaultOptimizationSettings.ToString(),$htmlwhite)
                                    $rowdata += @(,("Enable optimization:",($Script:htmlsb), $OPTEnableOptimization,$htmlwhite))
                                    $rowdata += @(,("Optimization type:",($Script:htmlsb), $OPTOptimizationType,$htmlwhite))
     
                                    $msg = "Optimization"
                                    $columnWidths = @("300","275")
                                    FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                    WriteHTMLLine 0 0 ""
     
                                    WriteHTMLLine 4 0 "Windows Defender ATP: " $OPTWindowsDefenderATPEnabled
                                    If($OPTWindowsDefenderATPEnabled -eq "True")
                                    {
                                            $rowdata = @()
                                            $columnHeaders = @("Windows Defender ATP Optimizations",($Script:htmlsb),"",$htmlwhite)
     
                                            If($RDSHost.Optimization.WindowsDefenderATP.WinDefATPTurnOffOn.ToString() -eq "TurnOffWindowsDefenderATP")
                                            {
                                                    $rowdata += @(,("     Turn off Windows Defender ATP (I use my own ATP solution)",($Script:htmlsb), "",$htmlwhite))
                                            }
                                            Else
                                            {
                                                    $rowdata += @(,("     Turn on Windows Defender ATP and set process and folder exclusions",($Script:htmlsb), "",$htmlwhite))
                                                    $rowdata += @(,("     Disable real-time protection",($Script:htmlsb), $RDSHost.Optimization.WindowsDefenderATP.DisableRealTimeProtection.ToString(),$htmlwhite))
                                                    $rowdata += @(,("",($Script:htmlsb), "",$htmlwhite))
                                                    
                                                    $cnt = -1
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeFolders)
                                                    {
                                                            $cnt++
                                                            If($cnt -eq 0)
                                                            {
                                                                    $rowdata += @(,("     Exclude files and folders",($Script:htmlsb), $item,$htmlwhite))
                                                            }
                                                            Else
                                                            {
                                                                    $rowdata += @(,("",($Script:htmlsb), $item,$htmlwhite))
                                                            }
                                                    }
     
                                                    $cnt = -1
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeProcesses)
                                                    {
                                                            $cnt++
                                                            If($cnt -eq 0)
                                                            {
                                                                    $rowdata += @(,("     Exclude processes",($Script:htmlsb), $item,$htmlwhite))
                                                            }
                                                            Else
                                                            {
                                                                    $rowdata += @(,("",($Script:htmlsb), $item,$htmlwhite))
                                                            }
                                                    }
                                                    
                                                    $cnt = -1
                                                    ForEach($item in $RDSHost.Optimization.WindowsDefenderATP.ExcludeExtension)
                                                    {
                                                            $cnt++
                                                            If($cnt -eq 0)
                                                            {
                                                                    $rowdata += @(,("     Exclude extensions",($Script:htmlsb), $item,$htmlwhite))
                                                            }
                                                            Else
                                                            {
                                                                    $rowdata += @(,("",($Script:htmlsb), $item,$htmlwhite))
                                                            }
                                                    }
                                            }
     
     
                                            $msg = ""
                                            $columnWidths = @("300","275")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Windows Components: " $OPTWindowsComponentsEnabled
                                    If($OPTWindowsComponentsEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Windows Components Optimizations"
     
                                            $rowdata = @()
     
                                            ForEach($item in $RDSHost.Optimization.WindowsComponents.WindowsComponentsList)
                                            {
                                                    $rowdata += @(,(
                                                            $item.DisplayName,$htmlwhite,
                                                            $item.ComponentName,$htmlwhite)
                                                    )
                                            }
     
                                            $columnHeaders = @(
                                                    "Display Name",($Script:htmlsb),
                                                    "Component",($Script:htmlsb)
                                            )
     
                                            $msg = "Disable (remove) components:"
                                            $columnWidths = @("200","200")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Windows Services: " $OPTWindowsServicesEnabled       
                                    If($OPTWindowsServicesEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Windows Services Optimizations"
     
                                            $rowdata = @()
     
                                            ForEach($item in $RDSHost.Optimization.WindowsServices.WindowsServicesList)
                                            {
                                                    $rowdata += @(,(
                                                            $item.DisplayName,$htmlwhite,
                                                            $item.ServiceName,$htmlwhite,
                                                            $item.Aliases,$htmlwhite)
                                                    )
                                            }
     
                                            $columnHeaders = @(
                                                    "Display Name",($Script:htmlsb),
                                                    "Service",($Script:htmlsb),
                                                    "Aliases",($Script:htmlsb)
                                            )
     
                                            $msg = "Disable services:"
                                            $columnWidths = @("200","100","50")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Windows Scheduled Tasks: " $OPTWinodwsScheduledTasksEnabled
                                    If($OPTWinodwsScheduledTasksEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Windows Scheduled Tasks Optimizations"
     
                                            $rowdata = @()
     
                                            ForEach($item in $RDSHost.Optimization.WindowsScheduledTasks.WindowsScheduledTasksList)
                                            {
                                                    $rowdata += @(,(
                                                            $item.Task,$htmlwhite,
                                                            $item.Type.Tostring(),$htmlwhite,
                                                            $item.Location,$htmlwhite)
                                                    )
                                            }
     
                                            $columnHeaders = @(
                                                    "Task",($Script:htmlsb),
                                                    "Type",($Script:htmlsb),
                                                    "Location",($Script:htmlsb)
                                            )
     
                                            $msg = "Disable tasks:"
                                            $columnWidths = @("200","50","250")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Windows advanced options: " $OPTWindowsAdvancedOptionsEnabled
                                    If($OPTWindowsAdvancedOptionsEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Windows Advanced Options"
     
                                            $rowdata = @()
     
                                            $rowdata += @(,(
                                                    "Disable Hibernate",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.Hibernate.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable Telemetry collection",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.TeleCollection.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable System Restore",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.SystemRestore.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable error reporting to send additional data",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.AdditionalErrorReport.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable Tiles",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.Tiles.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable Cortana digital assistant",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.Cortana.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Turn off Microsoft consumer experience",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.MicrosoftConsumerExperience.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Do not show Windows tips",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.WindowsTips.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Remove Common program groups from the Start Menu",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.CommonProgramGroups.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Partial Start Menu layout",$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.PartialStartMenu.ToString(),$htmlwhite,
                                                    $RDSHost.Optimization.WindowsAdvancedOptions.PartialStartLayoutContent,$htmlwhite)
                                            )
     
                                            $columnHeaders = @(
                                                    "Setting",($Script:htmlsb),
                                                    "Enabled",($Script:htmlsb),
                                                    "Value",($Script:htmlsb)
                                            )
     
                                            $msg = ""
                                            $columnWidths = @("300","50","200")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Network performance: " $OPTNetworkPerformanceEnabled
                                    If($OPTWindowsAdvancedOptionsEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Network Performance Optimizations"
     
                                            $rowdata = @()
     
                                            $rowdata += @(,(
                                                    "FileInfoCacheEntriesMax",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.FileInfoCacheEnable.ToString(),$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.FileInfoCache,$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "DirectoryCacheEntriesMax",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DirectoryCacheEnable.ToString(),$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DirCacheMax,$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "FileNotFoundCacheEntriesMax",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.FileNotFoundCacheEnable.ToString(),$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.FileNotFoundCache,$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "DormantFileLimit",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DormantFileLimitEnable.ToString(),$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DormantFileLimit,$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable TCP/IP Task Offload",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DisableTCP.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable IPv6 Components",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DisableIPv6CompEnable.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disable IPv6 to IPv4",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DisableIPv6ToIPv4.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Disables isatap for IPv6",$htmlwhite,
                                                    $RDSHost.Optimization.NetworkPerformance.DisableIsaTap.ToString(),$htmlwhite,
                                                    "",$htmlwhite)
                                            )
     
                                            $columnHeaders = @(
                                                    "Setting",($Script:htmlsb),
                                                    "Enabled",($Script:htmlsb),
                                                    "Value",($Script:htmlsb)
                                            )
     
                                            $msg = ""
                                            $columnWidths = @("170","50","50")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Registry: " $OPTRegistryEnabled       
                                    If($OPTRegistryEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Registry Optimizations"
     
                                            $rowdata = @()
     
                                            ForEach($item in $RDSHost.Optimization.Registry.RegistryList)
                                            {
                                                    $rowdata += @(,(
                                                            $item.DisplayName,$htmlwhite,
                                                            $item.Action,$htmlwhite,
                                                            $item.RegistryName,$htmlwhite,
                                                            $item.RegType,$htmlwhite,
                                                            $item.DWORDValue,$htmlwhite,
                                                            "$($item.HiveType)\$($item.Path)",$htmlwhite)
                                                    )
                                            }
     
                                            $columnHeaders = @(
                                                    "Registry",($Script:htmlsb),
                                                    "Action",($Script:htmlsb),
                                                    "Value",($Script:htmlsb),
                                                    "Type",($Script:htmlsb),
                                                    "Data",($Script:htmlsb),
                                                    "Path",($Script:htmlsb)
                                            )
     
                                            $msg = ""
                                            $columnWidths = @("200","50","100","100","100","200")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Visual Effects: " $OPTVisualEffectsEnabled
                                    If($OPTVisualEffectsEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Visual Effects Optimizations"
     
                                            $rowdata = @()
     
                                            $rowdata += @(,(
                                                    "Animate controls and elements inside windows",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.AnimateControlSelectElements.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Animate windows when minimizing and maximizing",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.AnimateWindowsWhenMinimizingMaximizing.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Animations in the taskbar",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.AnimateTaskbar.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Enable Peek",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.EnablePeek.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Fade or slide menus into view",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.FadeSlideMenus.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Fade or slide Tooltips into view",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.FadeSlideToolTips.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Fade out menu items after clicking",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.FadeOutMenuItems.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Save taskbar thumbnail previews",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.SaveTaskbarThumbnail.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Show shadows under mouse pointer",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.ShowShadowUnderMouse.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Show shadows under windows",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.ShadowUnderWindows.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Show thumbnails instead of icons",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.ThumbnailsInsteadOfIcons.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Show translucent selection rectangle",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.ShowTranslucentSelection.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Show window contents while dragging",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.ShowWindowsContentWhilstDragging.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Slide open combo boxes",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.SlideOpenComboBoxes.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Smooth edges of screen fonts",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.SmoothEdgesScreenFonts.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Smooth-scroll list boxes",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.SmoothScrollListBoxes.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Use drop shadows for icon labels on the desktop",$htmlwhite,
                                                    $RDSHost.Optimization.VisualEffects.DropShadowsIcon.ToString(),$htmlwhite)
                                            )
     
                                            $columnHeaders = @(
                                                    "Setting",($Script:htmlsb),
                                                    "Enabled",($Script:htmlsb)
                                            )
     
                                            $msg = ""
                                            $columnWidths = @("275","50")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Disk cleanup: " $OPTDiskCleanupEnabled
                                    If($OPTDiskCleanupEnabled -eq "True")
                                    {
                                            WriteHTMLLine 0 0 "Disk Cleanup Optimizations"
     
                                            $rowdata = @()
     
                                            $rowdata += @(,(
                                                    "Clean up redundant system files",$htmlwhite,
                                                    $RDSHost.Optimization.DiskCleanup.CleanupSystemFiles.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Clean up the WinSxS Folder",$htmlwhite,
                                                    $RDSHost.Optimization.DiskCleanup.CleanupWinSxSFolder.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Clean up temporary files and logs",$htmlwhite,
                                                    $RDSHost.Optimization.DiskCleanup.CleanupTemporaryFileLogs.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Remove OneDrive",$htmlwhite,
                                                    $RDSHost.Optimization.DiskCleanup.RemoveOneDrive.ToString(),$htmlwhite)
                                            )
     
                                            $rowdata += @(,(
                                                    "Delete users' profiles",$htmlwhite,
                                                    $RDSHost.Optimization.DiskCleanup.DeleteUserProfiles.ToString(),$htmlwhite)
                                            )
     
                                            $columnHeaders = @(
                                                    "Setting",($Script:htmlsb),
                                                    "Enabled",($Script:htmlsb)
                                            )
     
                                            $msg = ""
                                            $columnWidths = @("200","50")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
     
                                    WriteHTMLLine 4 0 "Custom script: " $OPTCustomScriptEnabled
                                    If($OPTCustomScriptEnabled -eq "True")
                                    {
                                            $rowdata = @()
                                            $columnHeaders = @("Custom Script",($Script:htmlsb),"",$htmlwhite)
                                            $rowdata += @(,("     Command",($Script:htmlsb), $RDSHost.Optimization.CustomScript.Command,$htmlwhite))
                                            $rowdata += @(,("     Arguments",($Script:htmlsb), $RDSHost.Optimization.CustomScript.Arguments,$htmlwhite))
                                            $rowdata += @(,("     Initial directory",($Script:htmlsb), $RDSHost.Optimization.CustomScript.InitDir,$htmlwhite))
                                            $rowdata += @(,("     Username",($Script:htmlsb), $RDSHost.Optimization.CustomScript.User,$htmlwhite))
     
                                            $msg = ""
                                            $columnWidths = @("125","200")
                                            FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                            WriteHTMLLine 0 0 ""
                                    }
                            }
     
                            #Desktop Access
                            
                            If($MSWord -or $PDF)
                            {
                                    WriteWordLine 4 0 "Desktop access"
                            }
                            If($Text)
                            {
                                    Line 3 "Desktop access"
                            }
                            If($HTML)
                            {
                                    #Nothing
                            }
                            
                            If($RDSHost.InheritDefaultDesktopAccessSettings)
                            {
                                    #do we inherit group or site defaults?
                                    #is this RDS host in a group?
                                    #http://woshub.com/hot-to-convert-sid-to-username-and-vice-versa/
                                    #for translating the User SID to the AD user name
                                    $Results = Get-RASRDSGroup -SiteId $Site.Id -EA 0 4>$Null
                                    
                                    If($? -and $Null -ne $Results)
                                    {
                                            If($Results.RDSIds -Contains $RDSHost.Id )
                                            {
                                                    #does this group inherit default settings?
                                                    If($Results.InheritDefaultDesktopAccessSettings -eq $False)
                                                    {
                                                            #no we don't, so get the default settings for the group
                                                            $GroupDefaults = $Results.RDSDefSettings
     
                                                            $RDSRestrictDesktopAccess = $GroupDefaults.RestrictDesktopAccess.ToString()
                                                            $RDSRestrictedUsers       = @()
                                                            
                                                            ForEach($User in $GroupDefaults.RestrictedUsers)
                                                            {
                                                                    $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)
                                                                    $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
                                                                    
                                                                    $RDSRestrictedUsers += $objUser.Value
                                                            }
                                                    }
                                                    Else
                                                    {
                                                            #yes we do, get the default settings for the Site
                                                            #use the Site default settings
                                                            $RDSDefaults = Get-RASRDSDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
                                                            
                                                            If($? -and $Null -ne $RDSDefaults)
                                                            {
                                                                    $RDSRestrictDesktopAccess = $RDSDefaults.RestrictDesktopAccess.ToString()
                                                                    $RDSRestrictedUsers       = @()
                                                                    
                                                                    ForEach($User in $RDSDefaults.RestrictedUsers)
                                                                    {
                                                                            $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)
                                                                            $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
                                                                            
                                                                            $RDSRestrictedUsers += $objUser.Value
                                                                    }
                                                            }
                                                            Else
                                                            {
                                                                    #unable to retrieve default, use built-in default values
                                                                    $RDSRestrictDesktopAccess = "False"
                                                                    $RDSRestrictedUsers       = @()
                                                            }
                                                    }
                                            }
                                    }
                                    Else
                                    {
                                            #RDS Host is not in a group
                                            #get the settings for the host
                                            $RDSRestrictDesktopAccess = $RDSHost.RestrictDesktopAccess.ToString()
                                            $RDSRestrictedUsers       = @()
                                            
                                            ForEach($User in $RDSHost.RestrictedUsers)
                                            {
                                                    $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)
                                                    $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
                                                    
                                                    $RDSRestrictedUsers += $objUser.Value
                                            }
                                    }
                            }
                            Else
                            {
                                    #we don't inherit
                                    #get the settings for the host
                                    $RDSRestrictDesktopAccess = $RDSHost.RestrictDesktopAccess.ToString()
                                    $RDSRestrictedUsers       = @()
                                    
                                    ForEach($User in $RDSHost.RestrictedUsers)
                                    {
                                            $objSID  = New-Object System.Security.Principal.SecurityIdentifier ($User)
                                            $objUser = $objSID.Translate( [System.Security.Principal.NTAccount])
                                            
                                            $RDSRestrictedUsers += $objUser.Value
                                    }
                            }
                                    
                            If($MSWord -or $PDF)
                            {
                                    $ScriptInformation = New-Object System.Collections.ArrayList
                                    $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $RDSHost.InheritDefaultDesktopAccessSettings.ToString(); }) > $Null
                                    $ScriptInformation.Add(@{Data = "Restrict direct desktop access to the following users"; Value = $RDSRestrictDesktopAccess; }) > $Null
                                    
                                    $cnt = -1
                                    ForEach($Item in $RDSRestrictedUsers)
                                    {
                                            $cnt++
                                            If($cnt -eq 0)
                                            {
                                                    $ScriptInformation.Add(@{Data = "Users"; Value = $Item; }) > $Null
                                            }
                                            Else
                                            {
                                                    $ScriptInformation.Add(@{Data = ""; Value = $Item; }) > $Null
                                            }
                                    }
     
                                    $Table = AddWordTable -Hashtable $ScriptInformation `
                                    -Columns Data,Value `
                                    -List `
                                    -Format $wdTableGrid `
                                    -AutoFit $wdAutoFitFixed;
     
                                    SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                    SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                    $Table.Columns.Item(1).Width = 250;
                                    $Table.Columns.Item(2).Width = 250;
     
                                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                    FindWordDocumentEnd
                                    $Table = $Null
                                    WriteWordLine 0 0 ""
                            }
 
  -+                                                         $RDSRemoveClientNameFromPrinter          = $GroupDefaults.RemoveClientNameFromPrinterName.ToString()
 
  -+                                                                 $RDSRemoveClientNameFromPrinter          = $RDSDefaults.RemoveClientNameFromPrinterName.ToString()
 
  -+                                                                 $RDSRemoveClientNameFromPrinter          = "False"
 
  -+                                         $RDSRemoveClientNameFromPrinter          = $RDSHost.RemoveClientNameFromPrinterName.ToString()
 
  -+                                 $RDSRemoveClientNameFromPrinter          = $RDSHost.RemoveClientNameFromPrinterName.ToString()
 
  -+                                 If($RDSHost.RemoveSessionNumberFromPrinterName)
                                    {
                                            $ScriptInformation.Add(@{Data = "Remove client name from printer name"; Value = $RDSRemoveClientNameFromPrinter; }) > $Null
                                    }
 
  -+                                 If($RDSHost.RemoveSessionNumberFromPrinterName)
                                    {
                                            Line 4 "Remove client name from printer name`t`t`t: " $RDSRemoveClientNameFromPrinter
                                    }
 
  -+                                 If($RDSHost.RemoveSessionNumberFromPrinterName)
                                    {
                                            $rowdata += @(,("Remove client name from printer name",($Script:htmlsb),$RDSRemoveClientNameFromPrinter,$htmlwhite))
                                    }
 
  -+                         
                            #Get the agent state for the group
                            $RDSGroupStatus = Get-RASRDSGroupStatus -Name $RDSGroup.Name -EA 0 4>$Null
                            
                            If(!$? -or $Null -eq $RDSGroupStatus)
                            {
                                    $RDSGroupAgentState = "Unknown"
                            }
                            Else
                            {
                                    $RDSGroupAgentState = GetRASStatus $RDSGroupStatus.AgentState
                            }
                            
 
  -+                                 $ScriptInformation.Add(@{Data = "Status"; Value = $RDSGroupAgentState; }) > $Null
 
  -+                                 Line 2 "Status`t`t`t: " $RDSGroupAgentState
 
  -+                                 $rowdata += @(,("Status",($Script:htmlsb),$RDSGroupAgentState,$htmlwhite))
 
                                $ScriptInformation.Add(@{Data = "RD session hosts based on a template"; Value = $RDSGroup.UseRASTemplate; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "RD session hosts based on a template"; Value = $RDSGroup.Autoscale; }) > $Null
 
                                Line 3 "RD session hosts based on a template`t: " $RDSGroup.UseRASTemplate <>                                 Line 3 "RD session hosts based on a template`t: " $RDSGroup.Autoscale
 
                                $rowdata += @(,("RD session hosts based on a template",($Script:htmlsb),$RDSGroup.UseRASTemplate.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("RD session hosts based on a template",($Script:htmlsb),$RDSGroup.Autoscale.ToString(),$htmlwhite))
 
                                                "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled"; Break} <>                                                 "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                     Break}
                                                "Disbaled"                                              {$RDSAllowClientURLMailRedirection = "Disabled"; Break}                                                   "Disabled"                                              {$RDSAllowClientURLMailRedirection = "Disabled";
                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                     Break}
                                                "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled (Replace Registered Application)"; Break}                                                   "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                                     $ReplaceRegisteredApplication = "True";
                                                                                                                     Break}
                                                Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSDefaults.AllowURLAndMailRedirection)"; Break}                                                   Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSDefaults.AllowURLAndMailRedirection)";
                                                                                                                     $ReplaceRegisteredApplication = "False";
                                                                                                                     Break}
 
                                                "Bidirectional"         {$RDSDragAndDrop = "Bidirectional"; Break} <>                                                 "Bidirectional"         {$RDSDragAndDrop = "Bidirectional";
                                                    $RDSAllowDragAndDrop = "True";
                                                    Break}
                                                "Disabled"                      {$RDSDragAndDrop = "Disabled"; Break}                                                   "Disabled"                      {$RDSDragAndDrop = "Disabled";
                                                    $RDSAllowDragAndDrop = "False";
                                                    Break}
                                                "ClientToServer"        {$RDSDragAndDrop = "Client to server only"; Break}                                                   "ClientToServer"        {$RDSDragAndDrop = "Client to server only";
                                                    $RDSAllowDragAndDrop = "True";
                                                    Break}
                                                "ServerToClient"        {$RDSDragAndDrop = "Server to client only"; Break}                                                   "ServerToClient"        {$RDSDragAndDrop = "Server to client only";
                                                    $RDSAllowDragAndDrop = "True";
                                                    Break}
                                                Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSDefaults.DragAndDropMode)"; Break}                                                   Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSDefaults.DragAndDropMode)";
                                                    $RDSAllowDragAndDrop = "False";
                                                    Break}
 
                                        If($RDSDefaults.PreferredPAId -eq 0) <>                                         If($RDSDefaults.PreferredBrokerId -eq 0)
 
                                                $RDSPreferredPublishingAgent = (Get-RASPA -Id $RDSDefaults.PreferredPAId -EA 0 4>$Null).Server <>                                                 $RDSPreferredPublishingAgent = (Get-RASBroker -Id $RDSDefaults.PreferredBrokerId -EA 0 4>$Null).Server
 
  -+                                         $ReplaceRegisteredApplication          = "False"
 
  -+                                         $RDSAllowDragAndDrop                   = "True"
 
                                        "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled"; Break} <>                                         "Enabled"                                               {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
                                        "Disbaled"                                              {$RDSAllowClientURLMailRedirection = "Disabled"; Break}                                           "Disabled"                                              {$RDSAllowClientURLMailRedirection = "Disabled";
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
                                        "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled (Replace Registered Application)"; Break}                                           "EnabledWithAppRegistration"    {$RDSAllowClientURLMailRedirection = "Enabled";
                                                                                                             $ReplaceRegisteredApplication = "True";
                                                                                                             Break}
                                        Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSGroup.AllowURLAndMailRedirection)"; Break}                                           Default                                                 {$RDSAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($RDSGroupDefaults.AllowURLAndMailRedirection)";
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
 
                                        "Bidirectional"         {$RDSDragAndDrop = "Bidirectional"; Break} <>                                         "Bidirectional"         {$RDSDragAndDrop = "Bidirectional";
                                            $RDSAllowDragAndDrop = "True";
                                            Break}
                                        "Disabled"                      {$RDSDragAndDrop = "Disabled"; Break}                                           "Disabled"                      {$RDSDragAndDrop = "Disabled";
                                            $RDSAllowDragAndDrop = "False";
                                            Break}
                                        "ClientToServer"        {$RDSDragAndDrop = "Client to server only"; Break}                                           "ClientToServer"        {$RDSDragAndDrop = "Client to server only";
                                            $RDSAllowDragAndDrop = "True";
                                            Break}
                                        "ServerToClient"        {$RDSDragAndDrop = "Server to client only"; Break}                                           "ServerToClient"        {$RDSDragAndDrop = "Server to client only";
                                            $RDSAllowDragAndDrop = "True";
                                            Break}
                                        Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSGroup.DragAndDropMode)"; Break}                                           Default                         {$RDSDragAndDrop = "Unable to determine Drag and drop: $($RDSGroupDefaults.DragAndDropMode)";
                                            $RDSAllowDragAndDrop = "False";
                                            Break}
 
                                If($RDSGroupDefaults.PreferredPAId -eq 0) <>                                 If($RDSGroupDefaults.PreferredBrokerId -eq 0)
 
                                        $RDSPreferredPublishingAgent = (Get-RASPA -Id $RDSGroupDefaults.PreferredPAId -EA 0 4>$Null).Server <>                                         $RDSPreferredPublishingAgent = (Get-RASBroker -Id $RDSGroupDefaults.PreferredBrokerId -EA 0 4>$Null).Server
 
  <>                                 $ScriptInformation.Add(@{Data = "Application session lingering"; Value = ""; }) > $Null
                                    $ScriptInformation.Add(@{Data = "     Disconnect active session after"; Value = $RDSPublishingSessionDisconnectTimeout; }) > $Null
                                    $ScriptInformation.Add(@{Data = "     Logoff disconnected session after"; Value = $RDSPublishingSessionResetTime; }) > $Null
                                    $ScriptInformation.Add(@{Data = "Other settings"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "Port"; Value = $RDSPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Port"; Value = $RDSPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "Max Sessions"; Value = $RDSMaxSessions; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Max Sessions"; Value = $RDSMaxSessions; }) > $Null
                                $ScriptInformation.Add(@{Data = "Publishing Session Disconnect Timeout"; Value = $RDSPublishingSessionDisconnectTimeout; }) > $Null    
                                $ScriptInformation.Add(@{Data = "Publishing Session Reset Timeout"; Value = $RDSPublishingSessionResetTime; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Preferred Connection Broker"; Value = $RDSPreferredPublishingAgent; }) > $Null
 
  <>                                 $ScriptInformation.Add(@{Data = "     Replace registered application"; Value = $ReplaceRegisteredApplication; }) > $Null
                                $ScriptInformation.Add(@{Data = "Support Windows Shell URL namespace objects"; Value = $RDSSupportShellURLNamespaceObject; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Support Windows Shell URL namespace objects"; Value = $RDSSupportShellURLNamespaceObject; }) > $Null
                                $ScriptInformation.Add(@{Data = "Drag and drop"; Value = $RDSDragAndDrop; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable Drag and drop"; Value = $RDSAllowDragandDrop; }) > $Null
                                $ScriptInformation.Add(@{Data = "Preferred Publishing Agent"; Value = $RDSPreferredPublishingAgent; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Direction"; Value = $RDSDragAndDrop; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "Allow file transfer command (HTML5 and Chrome clients)"; Value = $RDSAllowFileTransfer; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Allow file transfer command (Web (HTML5) and Chrome clients)"; Value = $RDSAllowFileTransfer; }) > $Null
                                $ScriptInformation.Add(@{Data = "Configure File Transfer"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Configure File Transfer"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Direction"; Value = $RDSFileTransferMode; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Direction"; Value = $RDSFileTransferMode; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Location"; Value = $RDSFileTransferLocation; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Location"; Value = $RDSFileTransferLocation; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Do not allow to change location"; Value = $RDSFileTransferChangeLocation; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Do not allow to change location"; Value = $RDSFileTransferChangeLocation; }) > $Null
                                    $ScriptInformation.Add(@{Data = "Enable drive redirection cache"; Value = $RDSEnableDriveRedirectionCache; }) > $Null
 
                                Line 3 "Inherit default settings`t`t`t`t: " $RDSGroup.InheritDefaultAgentSettings.ToString() <>                                 Line 3 "Inherit default settings`t`t`t`t`t: " $RDSGroup.InheritDefaultAgentSettings.ToString()
                                    Line 3 "Application session lingering"
                                    Line 4 "Disconnect active session after`t`t`t`t: " $RDSPublishingSessionDisconnectTimeout
                                    Line 4 "Logoff disconnected session after`t`t`t: " $RDSPublishingSessionResetTime
                                    Line 3 "Other settings"
                                Line 3 "Port`t`t`t`t`t`t`t: " $RDSPort                                   Line 4 "Port`t`t`t`t`t`t`t: " $RDSPort
                                Line 3 "Max Sessions`t`t`t`t`t`t: " $RDSMaxSessions                                   Line 4 "Max Sessions`t`t`t`t`t`t: " $RDSMaxSessions
                                Line 3 "Publishing Session Disconnect Timeout`t`t`t: " $RDSPublishingSessionDisconnectTimeout    
                                Line 3 "Publishing Session Reset Timeout`t`t`t: " $RDSPublishingSessionResetTime                                   Line 4 "Preferred Connection Broker`t`t`t`t: " $RDSPreferredPublishingAgent
                                Line 3 "Allow Client URL/Mail Redirection`t`t`t: " $RDSAllowClientURLMailRedirection                                   Line 3 "Allow Client URL/Mail Redirection`t`t`t`t: " $RDSAllowClientURLMailRedirection
                                    Line 4 "Replace registered application`t`t`t`t: " $ReplaceRegisteredApplication
                                Line 3 "Support Windows Shell URL namespace objects`t`t: " $RDSSupportShellURLNamespaceObject                                   Line 4 "Support Windows Shell URL namespace objects`t`t: " $RDSSupportShellURLNamespaceObject
                                Line 3 "Drag and drop`t`t`t`t`t`t: " $RDSDragAndDrop                                   Line 3 "Enable Drag and drop`t`t`t`t`t`t: " $RDSAllowDragandDrop
                                Line 3 "Preferred Publishing Agent`t`t`t`t: " $RDSPreferredPublishingAgent                                   Line 4 "Direction`t`t`t`t`t`t: " $RDSDragAndDrop
                                Line 3 "Allow 2xRemoteExec to send command to the client`t: " $RDSAllowRemoteExec                                   Line 3 "Allow 2xRemoteExec to send command to the client`t`t: " $RDSAllowRemoteExec
                                Line 3 "Use RemoteApp if available`t`t`t`t: " $RDSUseRemoteApps                                   Line 3 "Use RemoteApp if available`t`t`t`t`t: " $RDSUseRemoteApps
                                Line 3 "Enable applications monitoring`t`t`t`t: " $RDSEnableAppMonitoring                                   Line 3 "Enable applications monitoring`t`t`t`t`t: " $RDSEnableAppMonitoring
                                Line 3 "Allow file transfer command (HTML5 and Chrome clients)`t: " $RDSAllowFileTransfer                                   Line 3 "Allow file transfer command (Web (HTML5) and Chrome clients)`t: " $RDSAllowFileTransfer
                                Line 3 "Configure File Transfer"                                   Line 4 "Configure File Transfer"
                                Line 4 "Direction`t`t`t: " $RDSFileTransferMode                                   Line 5 "Direction`t`t`t: " $RDSFileTransferMode
                                Line 4 "Location`t`t`t: " $RDSFileTransferLocation                                   Line 5 "Location`t`t`t: " $RDSFileTransferLocation
                                Line 4 "Do not allow to change location`t: " $RDSFileTransferChangeLocation                                   Line 5 "Do not allow to change location : " $RDSFileTransferChangeLocation
                                    Line 3 "Enable drive redirection cache`t`t`t`t`t: " $RDSEnableDriveRedirectionCache
 
  <>                                 $rowdata += @(,("Application session lingering",($Script:htmlsb),"",$htmlwhite))
                                    $rowdata += @(,("     Disconnect active session after",($Script:htmlsb),$RDSPublishingSessionDisconnectTimeout,$htmlwhite))
                                    $rowdata += @(,("     Logoff disconnected session after",($Script:htmlsb),$RDSPublishingSessionResetTime,$htmlwhite))
                                    $rowdata += @(,("Other settings",($Script:htmlsb),$RDSPort,$htmlwhite))
                                $rowdata += @(,("Port",($Script:htmlsb),$RDSPort,$htmlwhite))                                   $rowdata += @(,("     Port",($Script:htmlsb),$RDSPort,$htmlwhite))
                                $rowdata += @(,("Max Sessions",($Script:htmlsb),$RDSMaxSessions,$htmlwhite))                                   $rowdata += @(,("     Max Sessions",($Script:htmlsb),$RDSMaxSessions,$htmlwhite))
                                $rowdata += @(,("Publishing Session Disconnect Timeout",($Script:htmlsb),$RDSPublishingSessionDisconnectTimeout,$htmlwhite))    
                                $rowdata += @(,("Publishing Session Reset Timeout",($Script:htmlsb),$RDSPublishingSessionResetTime,$htmlwhite))                                   $rowdata += @(,("     Preferred Connection Broker",($Script:htmlsb),$RDSPreferredPublishingAgent,$htmlwhite))
 
  <>                                 $rowdata += @(,("     Replace registered application",($Script:htmlsb),$ReplaceRegisteredApplication,$htmlwhite))
                                $rowdata += @(,("Support Windows Shell URL namespace objects",($Script:htmlsb),$RDSSupportShellURLNamespaceObject,$htmlwhite))                                   $rowdata += @(,("     Support Windows Shell URL namespace objects",($Script:htmlsb),$RDSSupportShellURLNamespaceObject,$htmlwhite))
                                $rowdata += @(,("Drag and drop",($Script:htmlsb),$RDSDragAndDrop,$htmlwhite))                                   $rowdata += @(,("Enable Drag and drop",($Script:htmlsb),$RDSAllowDragandDrop,$htmlwhite))
                                $rowdata += @(,("Preferred Publishing Agent",($Script:htmlsb),$RDSPreferredPublishingAgent,$htmlwhite))                                   $rowdata += @(,("     Direction",($Script:htmlsb),$RDSDragAndDrop,$htmlwhite))
 
                                $rowdata += @(,("Allow file transfer command (HTML5 and Chrome clients)",($Script:htmlsb),$RDSAllowFileTransfer,$htmlwhite)) <>                                 $rowdata += @(,("Allow file transfer command (Web (HTML5) and Chrome clients)",($Script:htmlsb),$RDSAllowFileTransfer,$htmlwhite))
                                $rowdata += @(,("Configure File Transfer",($Script:htmlsb),"",$htmlwhite))                                   $rowdata += @(,("     Configure File Transfer",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,("     Direction",($Script:htmlsb),$RDSFileTransferMode,$htmlwhite))                                   $rowdata += @(,("          Direction",($Script:htmlsb),$RDSFileTransferMode,$htmlwhite))
                                $rowdata += @(,("     Location",($Script:htmlsb),$RDSFileTransferLocation,$htmlwhite))                                   $rowdata += @(,("          Location",($Script:htmlsb),$RDSFileTransferLocation,$htmlwhite))
                                $rowdata += @(,("     Do not allow to change location",($Script:htmlsb),$RDSFileTransferChangeLocation,$htmlwhite))                                   $rowdata += @(,("          Do not allow to change location",($Script:htmlsb),$RDSFileTransferChangeLocation,$htmlwhite))
                                    $rowdata += @(,("Enable drive redirection cache",($Script:htmlsb),$RDSEnableDriveRedirectionCache,$htmlwhite))
 
                        If($Action -eq "Reboot - Drain Mode") <>                         <#If($Action -eq "Reboot - Drain Mode")
 
                        } <>                         }#>
                            <#RDSSchedItem  
                            Dropped Properties      DurationInSecs
                                                                    EndDateTime
                                                                    DisableAction
                            #>
                        ElseIf($Action -eq "Disable")                           <#ElseIf($Action -eq "Disable")
 
                        } <>                         }#>
 
                                If($Action -eq "Reboot - Drain Mode") <>                                 <#If($Action -eq "Reboot - Drain Mode")
 
                                } <>                                 }#>
                                $ScriptInformation.Add(@{Data = "Repeat"; Value = $Repeat; }) > $Null                                   $ScriptInformation.Add(@{Data = "Recur"; Value = $Repeat; }) > $Null
 
                                If($Action -eq "Reboot - Drain Mode") <>                                 <#If($Action -eq "Reboot - Drain Mode")
 
                                } <>                                 }#>
                                Line 3 "Repeat`t`t`t`t: " $Repeat                                   Line 3 "Recur`t`t`t`t: " $Repeat
 
                                If($Action -eq "Reboot - Drain Mode") <>                                 <#If($Action -eq "Reboot - Drain Mode")
 
                                } <>                                 }#>
                                $rowdata += @(,("Repeat",($Script:htmlsb),$Repeat,$htmlwhite))                                   $rowdata += @(,("Recur",($Script:htmlsb),$Repeat,$htmlwhite))
 
                                If($Action -eq "Reboot - Drain Mode") <>                                 <#If($Action -eq "Reboot - Drain Mode")
 
                                } <>                                 }#>
 
                                If($Action -eq "Reboot - Drain Mode") <>                                 <#If($Action -eq "Reboot - Drain Mode")
 
                                } <>                                 }#>
 
                                If($Action -eq "Reboot - Drain Mode") <>                                 <#If($Action -eq "Reboot - Drain Mode")
 
                                } <>                                 }#>
 
  <>                                         If(validobject $VDIHost Server)
                                            {
                                        $ScriptInformation.Add(@{Data = "Provider"; Value = $VDIHost.Server; }) > $Null                                                   $ScriptInformation.Add(@{Data = "Provider"; Value = $VDIHost.Server; }) > $Null
                                            }
 
  <>                                         If(validobject $VDIHost DirectAddress)
                                            {
                                        $ScriptInformation.Add(@{Data = "Direct address"; Value = $VDIHost.DirectAddress; }) > $Null                                                   $ScriptInformation.Add(@{Data = "Direct address"; Value = $VDIHost.DirectAddress; }) > $Null
                                            }
 
  <>                                         If(validobject $VDIHost Server)
                                            {
                                        Line 3 "Provider`t`t: " $VDIHost.Server                                                   Line 3 "Provider`t`t: " $VDIHost.Server
                                            }
 
  <>                                         If(validobject $VDIHost DirectAddress)
                                            {
                                        Line 3 "Direct address`t`t: " $VDIHost.DirectAddress                                                   Line 3 "Direct address`t`t: " $VDIHost.DirectAddress
                                            }
 
  <>                                         If(validobject $VDIHost Server)
                                            {
                                        $columnHeaders = @("Provider",($Script:htmlsb),$VDIHost.Server,$htmlwhite)                                                   $columnHeaders = @("Provider",($Script:htmlsb),$VDIHost.Server,$htmlwhite)
                                            }
                                            Else
                                            {
                                                    $columnHeaders = @("Provider",($Script:htmlsb),"",$htmlwhite)
                                            }
 
  <>                                         If(validobject $VDIHost DirectAddress)
                                            {
                                        $rowdata += @(,("Direct address",($Script:htmlsb),$VDIHost.DirectAddress,$htmlwhite))                                                   $rowdata += @(,("Direct address",($Script:htmlsb),$VDIHost.DirectAddress,$htmlwhite))
                                            }
 
  <>                         If(validobject $VDIHost PreferredBrokerId)
                            {
                        $HostPA = Get-RASPA -Id $VDIHost.PreferredPAId -EA 0 4>$Null                                   $HostPA = Get-RASBroker -Id $VDIHost.PreferredBrokerId -EA 0 4>$Null
                            }
                            Else
                            {
                                    $HostPA = $Null
                                    $DedicatedVDIAgent = $False
                            }
 
  <>                         <#
                        <#Switch ($VDIHost.DragAndDropMode)                           Switch ($VDIHost.DragAndDropMode)
 
                                "Bidirectional"         {$VDIHostDragAndDrop = "Bidirectional"; Break} <>                                 "Bidirectional"         {$VDIDragAndDrop = "Bidirectional";
                                    $VDIAllowDragAndDrop = "True";
                                    Break}
                                "Disabled"                      {$VDIHostDragAndDrop = "Disabled"; Break}                                   "Disabled"                      {$VDIDragAndDrop = "Disabled";
                                    $VDIAllowDragAndDrop = "False";
                                    Break}
                                "ClientToServer"        {$VDIHostDragAndDrop = "Client to server only"; Break}                                   "ClientToServer"        {$VDIDragAndDrop = "Client to server only";
                                    $VDIAllowDragAndDrop = "True";
                                    Break}
                                "ServerToClient"        {$VDIHostDragAndDrop = "Server to client only"; Break}                                   "ServerToClient"        {$VDIDragAndDrop = "Server to client only";
                                    $VDIAllowDragAndDrop = "True";
                                    Break}
                                Default                         {$VDIHostDragAndDrop = "Unable to determine Drag and drop: $($VDIHost.DragAndDropMode)"; Break}                                   Default                         {$VDIDragAndDrop = "Unable to determine Drag and drop: $($VDIHost.DragAndDropMode)";
                                    $VDIAllowDragAndDrop = "False";
                                    Break}
                            }
                            
                        }#>                           #>
                            $VDIDragAndDrop = ""
                            $VDIAllowDragAndDrop = ""
 
  <>                         If(validobject $VDIHost AllowURLAndMailRedirection)
                            {
                                    Switch($VDIHost.AllowURLAndMailRedirection)
                                    {
                                            "Enabled"                                               {$VDIAllowClientURLMailRedirection = "Enabled"; 
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
                                            "Disabled"                                              {$VDIAllowClientURLMailRedirection = "Disabled"; 
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
                                            "EnabledWithAppRegistration"    {$VDIAllowClientURLMailRedirection = "Enabled";
                                                                                                             $ReplaceRegisteredApplication = "True";
                                                                                                             Break}
                                            Default                                                 {$VDIAllowClientURLMailRedirection = "Unable to determine Allow CLient URL/Mail Redirection: $($VDIHost.AllowURLAndMailRedirection)"; 
                                                                                                             $ReplaceRegisteredApplication = "False";
                                                                                                             Break}
                                    }
                            }
                            Else
                            {
                                    $VDIAllowClientURLMailRedirection = ""
                                    $ReplaceRegisteredApplication = "";
                            }
                            
                            If(validobject $VDIHost FileTransferMode)
                            {
                        Switch ($VDIHost.FileTransferMode)                                   Switch ($VDIHost.FileTransferMode)
                        {                                   {
                                "Bidirectional"         {$VDIHostFileTransferMode = "Bidirectional"; Break}                                           "Bidirectional"         {$VDIHostFileTransferMode = "Bidirectional"; Break}
                                "Disabled"                      {$VDIHostFileTransferMode = "Disabled"; Break}                                           "Disabled"                      {$VDIHostFileTransferMode = "Disabled"; Break}
                                "ClientToServer"        {$VDIHostFileTransferMode = "Client to server only"; Break}                                           "ClientToServer"        {$VDIHostFileTransferMode = "Client to server only"; Break}
                                "ServerToClient"        {$VDIHostFileTransferMode = "Server to client only"; Break}                                           "ServerToClient"        {$VDIHostFileTransferMode = "Server to client only"; Break}
                                Default                         {$VDIHostFileTransferMode = "Unable to determine File Transfer mode: $($VDIHost.FileTransferMode)"; Break}                                           Default                         {$VDIHostFileTransferMode = "Unable to determine File Transfer mode: $($VDIHost.FileTransferMode)"; Break}
                        }                                   }
                            }
                            Else
                            {
                                    $VDIHostFileTransferMode = ""
                            }
 
  <>                         If(validobject $VDIHost FileTransferLocation)
                            {
                        If($VDIHost.FileTransferLocation -eq "")                                   If($VDIHost.FileTransferLocation -eq "")
                        {                                   {
                                $VDIHostFileTransferLocation = "Default download location"                                           $VDIHostFileTransferLocation = "Default download location"
                        }                                   }
                        Else                                   Else
                        {                                   {
                                $VDIHostFileTransferLocation = $VDIHostHost.FileTransferLocation                                           $VDIHostFileTransferLocation = $VDIHostHost.FileTransferLocation
                        }                                   }
                            }
                            Else
                            {
                                    $VDIHostFileTransferLocation = ""
                            }
 
                                $ScriptInformation.Add(@{Data = "Allow Client URL/Mail Redirection"; Value = $VDIHost.AllowURLAndMailRedirection.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Allow Client URL/Mail Redirection"; Value = $VDIAllowClientURLMailRedirection; }) > $Null
                                    $ScriptInformation.Add(@{Data = "     Replace registered application"; Value = $ReplaceRegisteredApplication; }) > $Null
                                    If(validobject $VDIHost SupportShellURLNamespaceObjects)
                                    {
                                $ScriptInformation.Add(@{Data = "Support Windows Shell URL namespace objects"; Value = $VDIHost.SupportShellURLNamespaceObjects.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "     Support Windows Shell URL namespace objects"; Value = $VDIHost.SupportShellURLNamespaceObjects.ToString(); }) > $Null
                                    }
                                #$ScriptInformation.Add(@{Data = "Drag and drop"; Value = $VDIHostDragAndDrop; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable Drag and drop"; Value = $VDIAllowDragAndDrop; }) > $Null
                                $ScriptInformation.Add(@{Data = "Preferred Publishing Agent"; Value = $VDIHostStatus.PreferredPA; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Direction"; Value = $VDIDragAndDrop; }) > $Null
                                    If(validobject $VDIHost AllowFileTransfer)
                                    {
                                $ScriptInformation.Add(@{Data = "Allow file transfer command (HTML5 and Chrome clients)"; Value = $VDIHost.AllowFileTransfer.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "Allow file transfer command (Web (HTML5) and Chrome clients)"; Value = $VDIHost.AllowFileTransfer.ToString(); }) > $Null
                                    }
                                $ScriptInformation.Add(@{Data = "Configure File Transfer"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Configure File Transfer"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Direction"; Value = $VDIHostFileTransferMode; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Direction"; Value = $VDIHostFileTransferMode; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Location"; Value = $VDIHostFileTransferLocation; }) > $Null                                   $ScriptInformation.Add(@{Data = "          Location"; Value = $VDIHostFileTransferLocation; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Do not allow to change location"; Value = $VDIHost.FileTransferLockLocation.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "          Do not allow to change location"; Value = $VDIHost.FileTransferLockLocation.ToString(); }) > $Null
                                    If(validobject $VDIHost EnableDriveRedirectionCache)
                                    {
                                $ScriptInformation.Add(@{Data = "Enable drive redirection cache"; Value = $VDIHost.EnableDriveRedirectionCache.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "Enable drive redirection cache"; Value = $VDIHost.EnableDriveRedirectionCache.ToString(); }) > $Null
                                    }
 
                                Line 4 "Allow Client URL/Mail Redirection`t`t`t: " $VDIHost.AllowURLAndMailRedirection.ToString() <>                                 Line 4 "Allow Client URL/Mail Redirection`t`t`t`t: " $VDIAllowClientURLMailRedirection
                                    Line 5 "Replace registered application`t`t`t`t: " $ReplaceRegisteredApplication
                                    If(validobject $VDIHost SupportShellURLNamespaceObjects)
                                    {
                                Line 4 "Support Windows Shell URL namespace objects`t`t: " $VDIHost.SupportShellURLNamespaceObjects.ToString()                                           Line 5 "Support Windows Shell URL namespace objects`t`t: " $VDIHost.SupportShellURLNamespaceObjects.ToString()
                                    }
                                #Line 4 "Drag and drop`t`t`t`t`t`t: " $VDIHostDragAndDrop                                   Line 4 "Enable Drag and drop`t`t`t`t`t`t: " $VDIAllowDragandDrop
                                Line 4 "Preferred Publishing Agent`t`t`t`t: " $VDIHostStatus.PreferredPA                                   Line 5 "Direction`t`t`t`t`t`t: " $VDIDragAndDrop
                                    If(validobject $VDIHost AllowFileTransfer)
                                    {
                                Line 4 "Allow file transfer command (HTML5 and Chrome clients)`t: " $VDIHost.AllowFileTransfer.ToString()                                           Line 4 "Allow file transfer command (Web (HTML5) and Chrome clients)`t: " $VDIHost.AllowFileTransfer.ToString()
                                    }
                                Line 4 "Configure File Transfer"                                   Line 5 "Configure File Transfer"
                                Line 5 "Direction`t`t`t: " $VDIHostFileTransferMode                                   Line 6 "Direction`t`t`t: " $VDIHostFileTransferMode
                                Line 5 "Location`t`t`t: " $VDIHostFileTransferLocation                                   Line 6 "Location`t`t`t: " $VDIHostFileTransferLocation
                                Line 5 "Do not allow to change location`t: " $VDIHost.FileTransferLockLocation.ToString()                                   Line 6 "Do not allow to change location : " $VDIHost.FileTransferLockLocation.ToString()
                                    If(validobject $VDIHost EnableDriveRedirectionCache)
                                    {
                                Line 4 "Enable drive redirection cache`t`t`t`t: " $VDIHost.EnableDriveRedirectionCache.ToString()                                           Line 4 "Enable drive redirection cache`t`t`t`t`t: " $VDIHost.EnableDriveRedirectionCache.ToString()
                                    }
                                    
 
                                $columnHeaders = @("Allow Client URL/Mail Redirection",($Script:htmlsb),$VDIHost.AllowURLAndMailRedirection.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Allow Client URL/Mail Redirection",($Script:htmlsb),$VDIAllowClientURLMailRedirection,$htmlwhite)
                                    $rowdata += @(,("     Replace registered application",($Script:htmlsb),$ReplaceRegisteredApplication,$htmlwhite))
                                    If(validobject $VDIHost SupportShellURLNamespaceObjects)
                                    {
                                $rowdata += @(,("Support Windows Shell URL namespace objects",($Script:htmlsb),$VDIHost.SupportShellURLNamespaceObjects.ToString(),$htmlwhite))                                           $rowdata += @(,("     Support Windows Shell URL namespace objects",($Script:htmlsb),$VDIHost.SupportShellURLNamespaceObjects.ToString(),$htmlwhite))
                                    }
                                #$rowdata += @(,("Drag and drop",($Script:htmlsb),$VDIHostDragAndDrop,$htmlwhite))                                   $rowdata += @(,("Enable Drag and drop",($Script:htmlsb),$VDIAllowDragAndDrop,$htmlwhite))
                                $rowdata += @(,("Preferred Publishing Agent",($Script:htmlsb),$VDIHostStatus.PreferredPA,$htmlwhite))                                   $rowdata += @(,("     Directon",($Script:htmlsb),$VDIDragAndDrop,$htmlwhite))
                                    If(validobject $VDIHost AllowFileTransfer)
                                    {
                                $rowdata += @(,("Allow file transfer command (HTML5 and Chrome clients)",($Script:htmlsb),$VDIHost.AllowFileTransfer.ToString(),$htmlwhite))                                           $rowdata += @(,("Allow file transfer command (Web (HTML5) and Chrome clients)",($Script:htmlsb),$VDIHost.AllowFileTransfer.ToString(),$htmlwhite))
                                    }
                                $rowdata += @(,("Configure File Transfer",($Script:htmlsb),"",$htmlwhite))                                   $rowdata += @(,("     Configure File Transfer",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,("     Direction",($Script:htmlsb),$VDIHostFileTransferMode,$htmlwhite))                                   $rowdata += @(,("          Direction",($Script:htmlsb),$VDIHostFileTransferMode,$htmlwhite))
                                $rowdata += @(,("     Location",($Script:htmlsb),$VDIHostFileTransferLocation,$htmlwhite))                                   $rowdata += @(,("          Location",($Script:htmlsb),$VDIHostFileTransferLocation,$htmlwhite))
                                $rowdata += @(,("     Do not allow to change location",($Script:htmlsb),$VDIHost.FileTransferLockLocation.ToString(),$htmlwhite))                                   $rowdata += @(,("          Do not allow to change location",($Script:htmlsb),$VDIHost.FileTransferLockLocation.ToString(),$htmlwhite))
                                    If(validobject $VDIHost EnableDriveRedirectionCache)
                                    {
                                $rowdata += @(,("Enable drive redirection cache",($Script:htmlsb),$VDIHost.EnableDriveRedirectionCache.ToString(),$htmlwhite))                                           $rowdata += @(,("Enable drive redirection cache",($Script:htmlsb),$VDIHost.EnableDriveRedirectionCache.ToString(),$htmlwhite))
                                    }
                                    
 
  <>                         If(validobject $VDIHost PrinterNameFormat)
                            {
                        Switch ($VDIHost.PrinterNameFormat)                                   Switch ($VDIHost.PrinterNameFormat)
                        {                                   {
                                "PrnFormat_PRN_CMP_SES" {$VDIPrinterNameFormat = "Printername (from Computername) in Session no."; Break}                                           "PrnFormat_PRN_CMP_SES" {$VDIPrinterNameFormat = "Printername (from Computername) in Session no."; Break}
                                "PrnFormat_SES_CMP_PRN" {$VDIPrinterNameFormat = "Session no. (Computername from) Printername"; Break}                                           "PrnFormat_SES_CMP_PRN" {$VDIPrinterNameFormat = "Session no. (Computername from) Printername"; Break}
                                "PrnFormat_PRN_REDSES"  {$VDIPrinterNameFormat = "Printername (redirected Session no.)"; Break}                                           "PrnFormat_PRN_REDSES"  {$VDIPrinterNameFormat = "Printername (redirected Session no.)"; Break}
                                Default                                 {$VDIPrinterNameFormat = "Unable to determine RDP Printer Name Format: $($VDIHost.PrinterNameFormat)"; Break}                                           Default                                 {$VDIPrinterNameFormat = "Unable to determine RDP Printer Name Format: $($VDIHost.PrinterNameFormat)"; Break}
                                    }
 
  -+                         Else
                            {
                                    $VDIPrinterNameFormat = ""
                            }
 
  <>                         If(validobject $VDIHost RemoveSessionNumberFromPrinterName)
                            {
                        $VDIRemoveSessionNumberFromPrinter = $VDIHost.RemoveSessionNumberFromPrinterName.ToString()                                   $VDIRemoveSessionNumberFromPrinter = $VDIHost.RemoveSessionNumberFromPrinterName.ToString()
                            }
                            Else
                            {
                                    $VDIRemoveSessionNumberFromPrinter = ""
                            }
 
                                Switch ($VDITemplate.UnusedGuestDurationMins) <>                                 Switch ($VDITemplate.UnusedVMDurationMins)
 
                                        Default {$DeleteVMsTime = "Unable to determine Delete unused guest VMs after: $($VDITemplate.UnusedGuestDurationMins)"; Break} <>                                         Default {$DeleteVMsTime = "Unable to determine Delete unused VMs after: $($VDITemplate.UnusedVMDurationMins)"; Break}
 
                                        $ScriptInformation.Add(@{Data = "Maximum guest VMs"; Value = $VDITemplate.MaxGuests.ToString(); }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Maximum guest VMs"; Value = $VDITemplate.MaxVMs.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Keep available buffer"; Value = $VDITemplate.PreCreatedGuests.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "Keep available buffer"; Value = $VDITemplate.PreCreatedVMs.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Guest VM name"; Value = $VDITemplate.GuestNameFormat; }) > $Null                                           $ScriptInformation.Add(@{Data = "Guest VM name"; Value = $VDITemplate.VMNameFormat; }) > $Null
 
                                        Line 4 "Maximum guest VMs`t`t: " $VDITemplate.MaxGuests.ToString() <>                                         Line 4 "Maximum guest VMs`t`t: " $VDITemplate.MaxVMs.ToString()
                                        Line 4 "Keep available buffer`t`t: " $VDITemplate.PreCreatedGuests.ToString()                                           Line 4 "Keep available buffer`t`t: " $VDITemplate.PreCreatedVMs.ToString()
                                        Line 4 "Guest VM name`t`t`t: " $VDITemplate.GuestNameFormat                                           Line 4 "Guest VM name`t`t`t: " $VDITemplate.VMNameFormat
 
                                        $rowdata += @(,("Maximum guest VMs",($Script:htmlsb),$VDITemplate.MaxGuests.ToString(),$htmlwhite)) <>                                         $rowdata += @(,("Maximum guest VMs",($Script:htmlsb),$VDITemplate.MaxVMs.ToString(),$htmlwhite))
                                        $rowdata += @(,("Keep available buffer",($Script:htmlsb),$VDITemplate.PreCreatedGuests.ToString(),$htmlwhite))                                           $rowdata += @(,("Keep available buffer",($Script:htmlsb),$VDITemplate.PreCreatedVMs.ToString(),$htmlwhite))
                                        $rowdata += @(,("Guest VM name",($Script:htmlsb),$VDITemplate.GuestNameFormat,$htmlwhite))                                           $rowdata += @(,("Guest VM name",($Script:htmlsb),$VDITemplate.VMNameFormat,$htmlwhite))
 
        $GWs = Get-RASGW -Siteid $Site.Id -EA 0 4> $Null <>         $Gateways = Get-RASGateway -Siteid $Site.Id -EA 0 4> $Null
 
        ElseIf($? -and $Null -eq $GWs) <>         ElseIf($? -and $Null -eq $Gateways)
 
                ForEach($GW in $GWs) <>                 ForEach($Gateway in $Gateways)
 
                        $GWStatus = Get-RASGWStatus -Id $GW.Id -EA 0 4>$Null <>                         $GatewayStatus = Get-RASGatewayStatus -Id $Gateway.Id -EA 0 4>$Null
 
                                Unable to retrieve Gateway Status for Gateway $($GW.Id)` <>                                 Unable to retrieve Gateway Status for Gateway $($Gateway.Id)`
 
                                        WriteWordLine 0 0 "Unable to retrieve Gateway Status for Gateway $($GW.Id)" <>                                         WriteWordLine 0 0 "Unable to retrieve Gateway Status for Gateway $($Gateway.Id)"
 
                                        Line 0 "Unable to retrieve Gateway Status for Gateway $($GW.Id)" <>                                         Line 0 "Unable to retrieve Gateway Status for Gateway $($Gateway.Id)"
 
                                        WriteHTMLLine 0 0 "Unable to retrieve Gateway Status for Gateway $($GW.Id)" <>                                         WriteHTMLLine 0 0 "Unable to retrieve Gateway Status for Gateway $($Gateway.Id)"
 
                                $GWEnableHSTS            = "Unable to retrieve Gateway Status" <>                                 $GatewayEnableHSTS            = "Unable to retrieve Gateway Status"
                                $GWEnableSSL             = "Unable to retrieve Gateway Status"                                   $GatewayEnableSSL             = "Unable to retrieve Gateway Status"
                                $GWEnableSSLOnPort       = "Unable to retrieve Gateway Status"                                   $GatewayEnableSSLOnPort       = "Unable to retrieve Gateway Status"
                                $GWAcceptedSSLVersions   = "Unable to retrieve Gateway Status"                                   $GatewayAcceptedSSLVersions   = "Unable to retrieve Gateway Status"
                                $GWCipherStrength        = "Unable to retrieve Gateway Status"                                   $GatewayCipherStrength        = "Unable to retrieve Gateway Status"
                                $GWCipher                = "Unable to retrieve Gateway Status"                                   $GatewayCipher                = "Unable to retrieve Gateway Status"
                                $GWCertificates          = "Unable to retrieve Gateway Status"                                   $GatewayCertificates          = "Unable to retrieve Gateway Status"
                                $GWHSTSMaxage            = "Unable to retrieve Gateway Status"                                   $GatewayHSTSMaxage            = "Unable to retrieve Gateway Status"
                                $GWHSTSIncludeSubdomains = "Unable to retrieve Gateway Status"                                   $GatewayHSTSIncludeSubdomains = "Unable to retrieve Gateway Status"
                                $GWHSTSPreload           = "Unable to retrieve Gateway Status"                                   $GatewayHSTSPreload           = "Unable to retrieve Gateway Status"
 
                        ElseIf($? -and $Null -eq $GWStatus) <>                         ElseIf($? -and $Null -eq $GatewayStatus)
 
                                No Gateway Status retrieved for Gateway $($GW.Id)` <>                                 No Gateway Status retrieved for Gateway $($Gateway.Id)`
 
                                        WriteWordLine 0 0 "No Gateway Status found for Gateway $($GW.Id)" <>                                         WriteWordLine 0 0 "No Gateway Status found for Gateway $($Gateway.Id)"
 
                                        Line 0 "No Gateway Status found for Gateway $($GW.Id)" <>                                         Line 0 "No Gateway Status found for Gateway $($Gateway.Id)"
 
                                        WriteHTMLLine 0 0 "No Gateway Status found for Gateway $($GW.Id)" <>                                         WriteHTMLLine 0 0 "No Gateway Status found for Gateway $($Gateway.Id)"
 
                                $GWEnableHSTS            = "" <>                                 $GatewayEnableHSTS            = ""
                                $GWEnableSSL             = ""                                   $GatewayEnableSSL             = ""
                                $GWEnableSSLOnPort       = ""                                   $GatewayEnableSSLOnPort       = ""
                                $GWAcceptedSSLVersions   = ""                                   $GatewayAcceptedSSLVersions   = ""
                                $GWCipherStrength        = ""                                   $GatewayCipherStrength        = ""
                                $GWCipher                = ""                                   $GatewayCipher                = ""
                                $GWCertificates          = ""                                   $GatewayCertificates          = ""
                                $GWHSTSMaxage            = ""                                   $GatewayHSTSMaxage            = ""
                                $GWHSTSIncludeSubdomains = ""                                   $GatewayHSTSIncludeSubdomains = ""
                                $GWHSTSPreload           = ""                                   $GatewayHSTSPreload           = ""
 
                                If($GW.InheritDefaultSslTlsSettings) <>                                 If($Gateway.InheritDefaultSslTlsSettings)
 
                                        $GWDefaults = Get-RASGWDefaultSettings -SiteId $Site.Id -EA 0 4>$Null <>                                         $GatewayDefaults = Get-RASGatewayDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
 
                                        If($? -and $Null -ne $GWDefaults) <>                                         If($? -and $Null -ne $GatewayDefaults)
 
                                                If($GWDefaults.EnableHSTS) <>                                                 If($GatewayDefaults.EnableHSTS)
 
                                                        $GWEnableHSTS            = $GWDefaults.EnableHSTS.ToString() <>                                                         $GatewayEnableHSTS            = $GatewayDefaults.EnableHSTS.ToString()
                                                        $GWHSTSMaxage            = $GWDefaults.HSTSMaxAge.ToString()                                                           $GatewayHSTSMaxage            = $GatewayDefaults.HSTSMaxAge.ToString()
                                                        $GWHSTSIncludeSubdomains = $GWDefaults.HSTSIncludeSubdomains.ToString()                                                           $GatewayHSTSIncludeSubdomains = $GatewayDefaults.HSTSIncludeSubdomains.ToString()
                                                        $GWHSTSPreload           = $GWDefaults.HSTSPreload.ToString()                                                           $GatewayHSTSPreload           = $GatewayDefaults.HSTSPreload.ToString()
 
                                                        $GWEnableHSTS = $GWDefaults.EnableHSTS.ToString() <>                                                         $GatewayEnableHSTS = $GatewayDefaults.EnableHSTS.ToString()
 
                                                $GWEnableSSL       = $GWDefaults.EnableSSL.ToString() <>                                                 $GatewayEnableSSL       = $GatewayDefaults.EnableSSL.ToString()
                                                $GWEnableSSLOnPort = $GWDefaults.SSLPort.ToString()                                                   $GatewayEnableSSLOnPort = $GatewayDefaults.SSLPort.ToString()
 
                                                Switch ($GWDefaults.MinSSLVersion) <>                                                 Switch ($GatewayDefaults.MinSSLVersion)
 
                                                        "SSLv2"         {$GWAcceptedSSLVersions = "SSL v2 - TLS v1.2 (Weak)"; Break} <>                                                         "SSLv2"         {$GatewayAcceptedSSLVersions = "SSL v2 - TLS v1.2 (Weak)"; Break}
                                                        "SSLv3"         {$GWAcceptedSSLVersions = "SSL v3 - TLS v1.2"; Break}                                                           "SSLv3"         {$GatewayAcceptedSSLVersions = "SSL v3 - TLS v1.2"; Break}
                                                        "TLSv1"         {$GWAcceptedSSLVersions = "TLS v1 - TLS v1.2"; Break}                                                           "TLSv1"         {$GatewayAcceptedSSLVersions = "TLS v1 - TLS v1.2"; Break}
                                                        "TLSv1_1"       {$GWAcceptedSSLVersions = "TLS v1.1 - TLS v1.2"; Break}                                                           "TLSv1_1"       {$GatewayAcceptedSSLVersions = "TLS v1.1 - TLS v1.2"; Break}
                                                        "TLSv1_2"       {$GWAcceptedSSLVersions = "TLS v1.2 only (Strong)"; Break}                                                           "TLSv1_2"       {$GatewayAcceptedSSLVersions = "TLS v1.2 only (Strong)"; Break}
                                                        Default         {$GWAcceptedSSLVersions = "Unable to determine Minimum SSL Version: $($GWDefaults.MinSSLVersion)"; Break}                                                           Default         {$GatewayAcceptedSSLVersions = "Unable to determine Minimum SSL Version: $($GatewayDefaults.MinSSLVersion)"; Break}
 
                                                $GWCipherStrength = $GWDefaults.CipherStrength.ToString() <>                                                 $GatewayCipherStrength = $GatewayDefaults.CipherStrength.ToString()
                                                $GWCipher         = $GWDefaults.Cipher                                                   $GatewayCipher         = $GatewayDefaults.Cipher
 
                                                If($GWDefaults.CertificateId -eq 0) <>                                                 If($GatewayDefaults.CertificateId -eq 0)
 
                                                        $GWCertificates = "All matching usage" <>                                                         $GatewayCertificates = "All matching usage"
 
                                                        $Results = Get-RASCertificate -Id $GWDefaults.CertificateId -EA 0 4>$Null <>                                                         $Results = Get-RASCertificate -Id $GatewayDefaults.CertificateId -EA 0 4>$Null
 
                                                                $GWCertificates = $Results.Name <>                                                                 $GatewayCertificates = $Results.Name
 
                                                                $GWCertificates = "Unable to determin Gateway Certificate: $($GWDefaults.CertificateId)" <>                                                                 $GatewayCertificates = "Unable to determin Gateway Certificate: $($GatewayDefaults.CertificateId)"
 
                                                $GWEnableHSTS          = "False" <>                                                 $GatewayEnableHSTS          = "False"
                                                $GWEnableSSL           = "True"                                                   $GatewayEnableSSL           = "True"
                                                $GWEnableSSLOnPort     = "443"                                                   $GatewayEnableSSLOnPort     = "443"
                                                $GWAcceptedSSLVersions = "TLS v1 - TLS v1.2"                                                   $GatewayAcceptedSSLVersions = "TLS v1 - TLS v1.2"
                                                $GWCipherStrength      = "High"                                                   $GatewayCipherStrength      = "High"
                                                $GWCipher              = "EECDH:!SSLv2:!SSLv3:!aNULL:!RC4:!ADH:!eNULL:!LOW:!MEDIUM:!EXP:+HIGH"                                                   $GatewayCipher              = "EECDH:!SSLv2:!SSLv3:!aNULL:!RC4:!ADH:!eNULL:!LOW:!MEDIUM:!EXP:+HIGH"
                                                $GWCertificates        = "All matching usage"                                                   $GatewayCertificates        = "All matching usage"
 
                                        If($GW.EnableHSTS) <>                                         If($Gateway.EnableHSTS)
 
                                                $GWEnableHSTS            = $GW.EnableHSTS.ToString() <>                                                 $GatewayEnableHSTS            = $Gateway.EnableHSTS.ToString()
                                                $GWHSTSMaxage            = $GW.HSTSMaxAge.ToString()                                                   $GatewayHSTSMaxage            = $Gateway.HSTSMaxAge.ToString()
                                                $GWHSTSIncludeSubdomains = $GW.HSTSIncludeSubdomains.ToString()                                                   $GatewayHSTSIncludeSubdomains = $Gateway.HSTSIncludeSubdomains.ToString()
                                                $GWHSTSPreload           = $GW.HSTSPreload.ToString()                                                   $GatewayHSTSPreload           = $Gateway.HSTSPreload.ToString()
 
                                                $GWEnableHSTS = $GW.EnableHSTS.ToString() <>                                                 $GatewayEnableHSTS = $Gateway.EnableHSTS.ToString()
 
                                        $GWEnableSSL       = $GW.EnableSSL.ToString() <>                                         $GatewayEnableSSL       = $Gateway.EnableSSL.ToString()
                                        $GWEnableSSLOnPort = $GW.SSLPort.ToString()                                           $GatewayEnableSSLOnPort = $Gateway.SSLPort.ToString()
 
                                        Switch ($GW.MinSSLVersion) <>                                         Switch ($Gateway.MinSSLVersion)
 
                                                "SSLv2"         {$GWAcceptedSSLVersions = "SSL v2 - TLS v1.2 (Weak)"; Break} <>                                                 "SSLv2"         {$GatewayAcceptedSSLVersions = "SSL v2 - TLS v1.2 (Weak)"; Break}
                                                "SSLv3"         {$GWAcceptedSSLVersions = "SSL v3 - TLS v1.2"; Break}                                                   "SSLv3"         {$GatewayAcceptedSSLVersions = "SSL v3 - TLS v1.2"; Break}
                                                "TLSv1"         {$GWAcceptedSSLVersions = "TLS v1 - TLS v1.2"; Break}                                                   "TLSv1"         {$GatewayAcceptedSSLVersions = "TLS v1 - TLS v1.2"; Break}
                                                "TLSv1_1"       {$GWAcceptedSSLVersions = "TLS v1.1 - TLS v1.2"; Break}                                                   "TLSv1_1"       {$GatewayAcceptedSSLVersions = "TLS v1.1 - TLS v1.2"; Break}
                                                "TLSv1_2"       {$GWAcceptedSSLVersions = "TLS v1.2 only (Strong)"; Break}                                                   "TLSv1_2"       {$GatewayAcceptedSSLVersions = "TLS v1.2 only (Strong)"; Break}
                                                Default         {$GWAcceptedSSLVersions = "Unable to determine Minimum SSL Version: $($GW.MinSSLVersion)"; Break}                                                   Default         {$GatewayAcceptedSSLVersions = "Unable to determine Minimum SSL Version: $($Gateway.MinSSLVersion)"; Break}
 
                                        $GWCipherStrength = $GW.CipherStrength.ToString() <>                                         $GatewayCipherStrength = $Gateway.CipherStrength.ToString()
                                        $GWCipher         = $GW.Cipher                                           $GatewayCipher         = $Gateway.Cipher
 
                                        If($GW.CertificateId -eq 0) <>                                         If($Gateway.CertificateId -eq 0)
 
                                                $GWCertificates = "All matching usage" <>                                                 $GatewayCertificates = "All matching usage"
 
                                                $Results = Get-RASCertificate -Id $GW.CertificateId -EA 0 4>$Null <>                                                 $Results = Get-RASCertificate -Id $Gateway.CertificateId -EA 0 4>$Null
 
                                                        $GWCertificates = $Results.Name.Replace("<","").Replace(">","")  <>                                                         $GatewayCertificates = $Results.Name.Replace("<","").Replace(">","")    
 
                                                        $GWCertificates = "Unable to determine Gateway Certificate: $($GW.CertificateId)" <>                                                         $GatewayCertificates = "Unable to determine Gateway Certificate: $($Gateway.CertificateId)"
 
                                $GWStatusAgentState = GetRASStatus $GWStatus.AgentState <>                                 $GatewayStatusAgentState = GetRASStatus $GatewayStatus.AgentState
 
                                        WriteWordLine 3 0 "Gateways $($GW.Server)" <>                                         WriteWordLine 3 0 "Gateways $($Gateway.Server)"
 
                                        $ScriptInformation.Add(@{Data = "Server"; Value = $GW.Server; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Server"; Value = $Gateway.Server; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Mode"; Value = $GW.GWMode; }) > $Null                                           $ScriptInformation.Add(@{Data = "Mode"; Value = $Gateway.Mode; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Status"; Value = $GWStatusAgentState; }) > $Null                                           $ScriptInformation.Add(@{Data = "Status"; Value = $GatewayStatusAgentState; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Description"; Value = $GW.Description; }) > $Null                                           $ScriptInformation.Add(@{Data = "Description"; Value = $Gateway.Description; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Certificate"; Value = $GWCertificates; }) > $Null                                           $ScriptInformation.Add(@{Data = "Certificate"; Value = $GatewayCertificates; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Log level"; Value = $GWStatus.LogLevel; }) > $Null                                           $ScriptInformation.Add(@{Data = "Log level"; Value = $GatewayStatus.LogLevel; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Last modification by"; Value = $GW.AdminLastMod; }) > $Null                                           $ScriptInformation.Add(@{Data = "Last modification by"; Value = $Gateway.AdminLastMod; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Modified on"; Value = $GW.TimeLastMod.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "Modified on"; Value = $Gateway.TimeLastMod.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Created by"; Value = $GW.AdminCreate; }) > $Null                                           $ScriptInformation.Add(@{Data = "Created by"; Value = $Gateway.AdminCreate; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Created on"; Value = $GW.TimeCreate.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "Created on"; Value = $Gateway.TimeCreate.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "ID"; Value = $GW.Id.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "ID"; Value = $Gateway.Id.ToString(); }) > $Null
 
                                        Line 2 "Gateways $($GW.Server)" <>                                         Line 2 "Gateways $($Gateway.Server)"
                                        Line 3 "Server`t`t`t: " $GW.Server                                           Line 3 "Server`t`t`t: " $Gateway.Server
                                        Line 3 "Mode`t`t`t: " $GW.GWMode                                           Line 3 "Mode`t`t`t: " $Gateway.Mode
                                        Line 3 "Status`t`t`t: " $GWStatusAgentState                                           Line 3 "Status`t`t`t: " $GatewayStatusAgentState
                                        Line 3 "Description`t`t: " $GW.Description                                           Line 3 "Description`t`t: " $Gateway.Description
                                        Line 3 "Certificate`t`t: " $GWCertificates                                           Line 3 "Certificate`t`t: " $GatewayCertificates
                                        Line 3 "Log level`t`t: " $GWStatus.LogLevel                                           Line 3 "Log level`t`t: " $GatewayStatus.LogLevel
                                        Line 3 "Last modification by`t: " $GW.AdminLastMod                                           Line 3 "Last modification by`t: " $Gateway.AdminLastMod
                                        Line 3 "Modified on`t`t: " $GW.TimeLastMod.ToString()                                           Line 3 "Modified on`t`t: " $Gateway.TimeLastMod.ToString()
                                        Line 3 "Created by`t`t: " $GW.AdminCreate                                           Line 3 "Created by`t`t: " $Gateway.AdminCreate
                                        Line 3 "Created on`t`t: " $GW.TimeCreate.ToString()                                           Line 3 "Created on`t`t: " $Gateway.TimeCreate.ToString()
                                        Line 3 "ID`t`t`t: " $GW.Id.ToString()                                           Line 3 "ID`t`t`t: " $Gateway.Id.ToString()
 
                                        WriteHTMLLine 3 0 "Gateways $($GW.Server)" <>                                         WriteHTMLLine 3 0 "Gateways $($Gateway.Server)"
 
                                        $columnHeaders = @("Server",($Script:htmlsb),$GW.Server,$htmlwhite) <>                                         $columnHeaders = @("Server",($Script:htmlsb),$Gateway.Server,$htmlwhite)
                                        $rowdata += @(,("Mode",($Script:htmlsb),$GW.GWMode.ToString(),$htmlwhite))                                           $rowdata += @(,("Mode",($Script:htmlsb),$Gateway.Mode.ToString(),$htmlwhite))
                                        $rowdata += @(,("Status",($Script:htmlsb),$GWStatusAgentState.ToString(),$htmlwhite))                                           $rowdata += @(,("Status",($Script:htmlsb),$GatewayStatusAgentState.ToString(),$htmlwhite))
                                        $rowdata += @(,("Description",($Script:htmlsb),$GW.Description,$htmlwhite))                                           $rowdata += @(,("Description",($Script:htmlsb),$Gateway.Description,$htmlwhite))
                                        $rowdata += @(,("Certificate",($Script:htmlsb),$GWCertificates,$htmlwhite))                                           $rowdata += @(,("Certificate",($Script:htmlsb),$GatewayCertificates,$htmlwhite))
                                        $rowdata += @(,("Log level",($Script:htmlsb),$GWStatus.LogLevel,$htmlwhite))                                           $rowdata += @(,("Log level",($Script:htmlsb),$GatewayStatus.LogLevel,$htmlwhite))
                                        $rowdata += @(,("Last modification by",($Script:htmlsb), $GW.AdminLastMod,$htmlwhite))                                           $rowdata += @(,("Last modification by",($Script:htmlsb), $Gateway.AdminLastMod,$htmlwhite))
                                        $rowdata += @(,("Modified on",($Script:htmlsb), $GW.TimeLastMod.ToString(),$htmlwhite))                                           $rowdata += @(,("Modified on",($Script:htmlsb), $Gateway.TimeLastMod.ToString(),$htmlwhite))
                                        $rowdata += @(,("Created by",($Script:htmlsb), $GW.AdminCreate,$htmlwhite))                                           $rowdata += @(,("Created by",($Script:htmlsb), $Gateway.AdminCreate,$htmlwhite))
                                        $rowdata += @(,("Created on",($Script:htmlsb), $GW.TimeCreate.ToString(),$htmlwhite))                                           $rowdata += @(,("Created on",($Script:htmlsb), $Gateway.TimeCreate.ToString(),$htmlwhite))
                                        $rowdata += @(,("ID",($Script:htmlsb),$GW.Id.ToString(),$htmlwhite))                                           $rowdata += @(,("ID",($Script:htmlsb),$Gateway.Id.ToString(),$htmlwhite))
 
                        Switch ($GW.IPVersion) <>                         Switch ($Gateway.IPVersion)
 
                                Default                 {$IPVersion = "Unable to determine IP version: $($GW.IPVersion)"; Break} <>                                 Default                 {$IPVersion = "Unable to determine IP version: $($Gateway.IPVersion)"; Break}
 
                        $GWIPs = $GW.IPs.Split(";") <>                         $GatewayIPs = $Gateway.IPs.Split(";")
 
                        If($GW.BindV4Addresses -eq "") <>                         If($Gateway.BindV4Addresses -eq "")
 
                                $GWBindV4Addresses = "All available addresses" <>                                 $GatewayBindV4Addresses = "All available addresses"
 
                                $GWBindV4Addresses = $GW.BindV4Addresses <>                                 $GatewayBindV4Addresses = $Gateway.BindV4Addresses
 
                        If($GW.OptimizeConnectionIPv4 -eq "<All>") <>                         If($Gateway.OptimizeConnectionIPv4 -eq "<All>")
 
                                $GWOptimizeV4 = "All available addresses" <>                                 $GatewayOptimizeV4 = "All available addresses"
 
                        ElseIf($GW.OptimizeConnectionIPv4 -eq "<None>") <>                         ElseIf($Gateway.OptimizeConnectionIPv4 -eq "<None>")
 
                                $GWOptimizeV4 = "None from the available" <>                                 $GatewayOptimizeV4 = "None from the available"
 
                                $GWOptimizeV4 = $GW.OptimizeConnectionIPv4 <>                                 $GatewayOptimizeV4 = $Gateway.OptimizeConnectionIPv4
 
                        If($GW.BindV6Addresses -eq "") <>                         If($Gateway.BindV6Addresses -eq "")
 
                                $GWBindV6Addresses = "All available addresses" <>                                 $GatewayBindV6Addresses = "All available addresses"
 
                                $GWBindV6Addresses = $GW.BindV6Addresses <>                                 $GatewayBindV6Addresses = $Gateway.BindV6Addresses
 
                        If($GW.OptimizeConnectionIPv6 -eq "<All>") <>                         If($Gateway.OptimizeConnectionIPv6 -eq "<All>")
 
                                $GWOptimizeV6 = "All available addresses" <>                                 $GatewayOptimizeV6 = "All available addresses"
 
                        ElseIf($GW.OptimizeConnectionIPv6 -eq "<None>") <>                         ElseIf($Gateway.OptimizeConnectionIPv6 -eq "<None>")
 
                                $GWOptimizeV6 = "None from the available" <>                                 $GatewayOptimizeV6 = "None from the available"
 
                                $GWOptimizeV6 = $GW.OptimizeConnectionIPv6 <>                                 $GatewayOptimizeV6 = $Gateway.OptimizeConnectionIPv6
 
                                $ScriptInformation.Add(@{Data = "Enable RAS Secure Client Gateway in Site"; Value = $GW.Enabled.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Enable RAS Secure Client Gateway in Site"; Value = $Gateway.Enabled.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Server"; Value = $GW.Server; }) > $Null                                   $ScriptInformation.Add(@{Data = "Server"; Value = $Gateway.Server; }) > $Null
                                $ScriptInformation.Add(@{Data = "Description"; Value = $GW.Description; }) > $Null                                   $ScriptInformation.Add(@{Data = "Description"; Value = $Gateway.Description; }) > $Null
 
                                ForEach($Item in $GWIPs) <>                                 ForEach($Item in $GatewayIPs)
 
                                If($GW.IPVersion -ne "Version6") <>                                 If($Gateway.IPVersion -ne "Version6")
 
                                        $ScriptInformation.Add(@{Data = "     Bind to the following IPv4"; Value = $GWBindV4Addresses; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "     Bind to the following IPv4"; Value = $GatewayBindV4Addresses; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     Remove system buffers for"; Value = $GWOptimizeV4; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Remove system buffers for"; Value = $GatewayOptimizeV4; }) > $Null
 
                                If($GW.IPVersion -ne "Version4") <>                                 If($Gateway.IPVersion -ne "Version4")
 
                                        $ScriptInformation.Add(@{Data = "     Bind to the following IPv6"; Value = $GWBindV6Addresses; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "     Bind to the following IPv6"; Value = $GatewayBindV6Addresses; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     Remove system buffers for"; Value = $GWOptimizeV6; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Remove system buffers for"; Value = $GatewayOptimizeV6; }) > $Null
 
                                Line 3 "Enable RAS Secure Client Gateway in Site: " $GW.Enabled.ToString() <>                                 Line 3 "Enable RAS Secure Client Gateway in Site: " $Gateway.Enabled.ToString()
                                Line 3 "Server`t`t`t`t`t: " $GW.Server                                   Line 3 "Server`t`t`t`t`t: " $Gateway.Server
                                Line 3 "Description`t`t`t`t: " $GW.Description                                   Line 3 "Description`t`t`t`t: " $Gateway.Description
 
                                ForEach($Item in $GWIPs) <>                                 ForEach($Item in $GatewayIPs)
 
                                If($GW.IPVersion -ne "Version6") <>                                 If($Gateway.IPVersion -ne "Version6")
 
                                        Line 4 "Bind to the following IPv4`t: " $GWBindV4Addresses <>                                         Line 4 "Bind to the following IPv4`t: " $GatewayBindV4Addresses
                                        Line 4 "Remove system buffers for`t: " $GWOptimizeV4                                           Line 4 "Remove system buffers for`t: " $GatewayOptimizeV4
 
                                If($GW.IPVersion -ne "Version4") <>                                 If($Gateway.IPVersion -ne "Version4")
 
                                        Line 4 "Bind to the following IPv6`t: " $GWBindV6Addresses <>                                         Line 4 "Bind to the following IPv6`t: " $GatewayBindV6Addresses
                                        Line 4 "Remove system buffers for`t: " $GWOptimizeV6                                           Line 4 "Remove system buffers for`t: " $GatewayOptimizeV6
 
                                $columnHeaders = @("Enable RAS Secure Client Gateway in Site",($Script:htmlsb),$GW.Enabled.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Enable RAS Secure Client Gateway in Site",($Script:htmlsb),$Gateway.Enabled.ToString(),$htmlwhite)
                                $rowdata += @(,("Server",($Script:htmlsb),$GW.Server,$htmlwhite))                                   $rowdata += @(,("Server",($Script:htmlsb),$Gateway.Server,$htmlwhite))
                                $rowdata += @(,("Description",($Script:htmlsb),$GW.Description,$htmlwhite))                                   $rowdata += @(,("Description",($Script:htmlsb),$Gateway.Description,$htmlwhite))
 
                                ForEach($Item in $GWIPs) <>                                 ForEach($Item in $GatewayIPs)
 
                                If($GW.IPVersion -ne "Version6") <>                                 If($Gateway.IPVersion -ne "Version6")
 
                                        $rowdata += @(,("     Bind to the following IPv4",($Script:htmlsb),$GWBindV4Addresses,$htmlwhite)) <>                                         $rowdata += @(,("     Bind to the following IPv4",($Script:htmlsb),$GatewayBindV4Addresses,$htmlwhite))
                                        $rowdata += @(,("     Remove system buffers for",($Script:htmlsb),$GWOptimizeV4,$htmlwhite))                                           $rowdata += @(,("     Remove system buffers for",($Script:htmlsb),$GatewayOptimizeV4,$htmlwhite))
 
                                If($GW.IPVersion -ne "Version4") <>                                 If($Gateway.IPVersion -ne "Version4")
 
                                        $rowdata += @(,("     Bind to the following IPv6",($Script:htmlsb),$GWBindV6Addresses,$htmlwhite)) <>                                         $rowdata += @(,("     Bind to the following IPv6",($Script:htmlsb),$GatewayBindV6Addresses,$htmlwhite))
                                        $rowdata += @(,("     Remove system buffers for",($Script:htmlsb),$GWOptimizeV6,$htmlwhite))                                           $rowdata += @(,("     Remove system buffers for",($Script:htmlsb),$GatewayOptimizeV6,$htmlwhite))
 
                        If($GW.InheritDefaultModeSettings) <>                         If($Gateway.InheritDefaultModeSettings)
 
                                $GWDefaults = Get-RASGWDefaultSettings -SiteId $Site.Id -EA 0 4>$Null <>                                 $GatewayDefaults = Get-RASGatewayDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
 
                                If($? -and $Null -ne $GWDefaults) <>                                 If($? -and $Null -ne $GatewayDefaults)
 
                                        $GWMode = $GWDefaults.GWMode.ToString() <>                                         $GatewayMode = $GatewayDefaults.Mode.ToString()
                                        $GWForwardRequests = $GWDefaults.NormalModeForwarding.ToString()                                           $GatewayForwardRequests = $GatewayDefaults.NormalModeForwarding.ToString()
                                        If($GWMode -eq "Normal")                                           If($GatewayMode -eq "Normal")
 
                                                $GWServers = $GWDefaults.ForwardHttpServers.Split(";") <>                                                 $GatewayServers = $GatewayDefaults.ForwardHttpServers.Split(";")
 
                                                $GWServers = $GWDefaults.ForwardGatewayServers.Split(";") <>                                                 $GatewayServers = $GatewayDefaults.ForwardGatewayServers.Split(";")
 
                                        If($GWDefaults.PreferredPAId -eq 0) <>                                         If($GatewayDefaults.PreferredBrokerId -eq 0)
 
                                                $GWPreferredPublishingAgent = "Automatically" <>                                                 $GatewayPreferredPublishingAgent = "Automatically"
 
                                                $GWPreferredPublishingAgent = (Get-RASPA -Id $GWDefaults.PreferredPAId -EA 0 4>$Null).Server <>                                                 $GatewayPreferredPublishingAgent = (Get-RASBroker -Id $GatewayDefaults.PreferredBrokerId -EA 0 4>$Null).Server
 
                                        $GWMode = "Normal" <>                                         $GatewayMode = "Normal"
                                        $GWForwardRequests = "False"                                           $GatewayForwardRequests = "False"
                                        $GWServers = @("localhost:81")                                           $GatewayServers = @("localhost:81")
                                        $GWPreferredPublishingAgent = "Automatically"                                           $GatewayPreferredPublishingAgent = "Automatically"
 
                                $GWMode = $GW.GWMode.ToString() <>                                 $GatewayMode = $Gateway.Mode.ToString()
                                $GWForwardRequests = $GW.NormalModeForwarding.ToString()                                   $GatewayForwardRequests = $Gateway.NormalModeForwarding.ToString()
                                If($GWMode -eq "Normal")                                   If($GatewayMode -eq "Normal")
 
                                        $GWServers = $GW.ForwardHttpServers.Split(";") <>                                         $GatewayServers = $Gateway.ForwardHttpServers.Split(";")
 
                                        $GWServers = $GW.ForwardGatewayServers.Split(";") <>                                         $GatewayServers = $Gateway.ForwardGatewayServers.Split(";")
 
                                If($GW.PreferredPAId -eq 0) <>                                 If($Gateway.PreferredBrokerId -eq 0)
 
                                        $GWPreferredPublishingAgent = "Automatically" <>                                         $GatewayPreferredPublishingAgent = "Automatically"
 
                                        $GWPreferredPublishingAgent = (Get-RASPA -Id $GW.PreferredPAId -EA 0 4>$Null).Server <>                                         $GatewayPreferredPublishingAgent = (Get-RASBroker -Id $Gateway.PreferredBrokerId -EA 0 4>$Null).Server
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $GW.InheritDefaultModeSettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $Gateway.InheritDefaultModeSettings.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Gateway mode"; Value = $GWMode; }) > $Null                                   $ScriptInformation.Add(@{Data = "Gateway mode"; Value = $GatewayMode; }) > $Null
 
                                If($GWMode -eq "Normal") <>                                 If($GatewayMode -eq "Normal")
 
                                        If($GWForwardRequests -eq "True") <>                                         If($GatewayForwardRequests -eq "True")
 
                                                $ScriptInformation.Add(@{Data = "Forward requests to HTTP Server"; Value = $GWForwardRequests; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = "Forward requests to HTTP Server"; Value = $GatewayForwardRequests; }) > $Null
 
                                                ForEach($Item in $GWServers) <>                                                 ForEach($Item in $GatewayServers)
 
                                        $ScriptInformation.Add(@{Data = "Preferred Publishing Agent"; Value = $GWPreferredPublishingAgent; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Preferred Connection Broker"; Value = $GatewayPreferredPublishingAgent; }) > $Null
 
                                        $ScriptInformation.Add(@{Data = "Forward requests to next RAS Secure Client Gateway in chain (cascaded firewall)"; Value = $GWForwardRequests; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Forward requests to next RAS Secure Client Gateway in chain (cascaded firewall)"; Value = $GatewayForwardRequests; }) > $Null
 
                                        If($GWForwardRequests -eq "True") <>                                         If($GatewayForwardRequests -eq "True")
 
                                                ForEach($Item in $GWServers) <>                                                 ForEach($Item in $GatewayServers)
 
                                Line 3 "Inherit default settings`t`t: " $GW.InheritDefaultModeSettings.ToString() <>                                 Line 3 "Inherit default settings`t`t: " $Gateway.InheritDefaultModeSettings.ToString()
                                Line 3 "Gateway mode`t`t`t`t: " $GWMode                                   Line 3 "Gateway mode`t`t`t`t: " $GatewayMode
                                If($GWMode -eq "Normal")                                   If($GatewayMode -eq "Normal")
 
                                        Line 3 "Forward requests to HTTP Server`t`t: " $GWForwardRequests <>                                         Line 3 "Forward requests to HTTP Server`t`t: " $GatewayForwardRequests
 
                                        ForEach($Item in $GWServers) <>                                         ForEach($Item in $GatewayServers)
 
                                        Line 3 "Preferred Publishing Agent`t`t: " $GWPreferredPublishingAgent <>                                         Line 3 "Preferred Connection Broker`t`t: " $GatewayPreferredPublishingAgent
 
                                        Line 3 "in chain (cascaded firewall)`t`t: " $GWForwardRequests <>                                         Line 3 "in chain (cascaded firewall)`t`t: " $GatewayForwardRequests
 
                                        ForEach($Item in $GWServers) <>                                         ForEach($Item in $GatewayServers)
 
                                $columnHeaders = @("Inherit default settings",($Script:htmlsb),$GW.InheritDefaultModeSettings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Inherit default settings",($Script:htmlsb),$Gateway.InheritDefaultModeSettings.ToString(),$htmlwhite)
                                $rowdata += @(,("Gateway mode",($Script:htmlsb),$GWMode,$htmlwhite))                                   $rowdata += @(,("Gateway mode",($Script:htmlsb),$GatewayMode,$htmlwhite))
                                If($GWMode -eq "Normal")                                   If($GatewayMode -eq "Normal")
 
                                        $rowdata += @(,("Forward requests to HTTP Server",($Script:htmlsb),$GWForwardRequests,$htmlwhite)) <>                                         $rowdata += @(,("Forward requests to HTTP Server",($Script:htmlsb),$GatewayForwardRequests,$htmlwhite))
 
                                        ForEach($Item in $GWServers) <>                                         ForEach($Item in $GatewayServers)
 
                                        $rowdata += @(,("Preferred Publishing Agent",($Script:htmlsb),$GWPreferredPublishingAgent,$htmlwhite)) <>                                         $rowdata += @(,("Preferred Connection Broker",($Script:htmlsb),$GatewayPreferredPublishingAgent,$htmlwhite))
 
                                        $rowdata += @(,("Forward requests to next RAS Secure Client Gateway in chain (cascaded firewall)",($Script:htmlsb),$GWForwardRequests,$htmlwhite)) <>                                         $rowdata += @(,("Forward requests to next RAS Secure Client Gateway in chain (cascaded firewall)",($Script:htmlsb),$GatewayForwardRequests,$htmlwhite))
 
                                        ForEach($Item in $GWServers) <>                                         ForEach($Item in $GatewayServers)
 
                        If($GW.InheritDefaultNetworkSettings) <>                         If($Gateway.InheritDefaultNetworkSettings)
 
                                $GWDefaults = Get-RASGWDefaultSettings -SiteId $Site.Id -EA 0 4>$Null <>                                 $GatewayDefaults = Get-RASGatewayDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
 
                                If($? -and $Null -ne $GWDefaults) <>                                 If($? -and $Null -ne $GatewayDefaults)
 
                                        $GWEnableRASSecureClientGatewayPort             = $GWDefaults.EnableGWPort.ToString() <>                                         $GatewayEnableRASSecureClientGatewayPort             = $GatewayDefaults.EnableGatewayPort.ToString()
                                        $GWRASSecureClientGatewayPort                   = $GWDefaults.GWPort.ToString()                                           $GatewayRASSecureClientGatewayPort                   = $GatewayDefaults.GatewayPort.ToString()
                                        $GWEnableRDPPort                                = $GWDefaults.EnableRDP.ToString()                                           $GatewayEnableRDPPort                                = $GatewayDefaults.EnableRDP.ToString()
                                        $GWRDPPort                                      = $GWDefaults.RDPPort.ToString()                                           $GatewayRDPPort                                      = $GatewayDefaults.RDPPort.ToString()
                                        $GWEnableBroadcastRASSecureClientGatewayAddress = $GWDefaults.Broadcast.ToString()                                           $GatewayEnableBroadcastRASSecureClientGatewayAddress = $GatewayDefaults.Broadcast.ToString()
                                        $GWEnableRDPUPDDataTunneling                    = $GWDefaults.EnableRDPUDP.ToString()                                           $GatewayEnableRDPUPDDataTunneling                    = $GatewayDefaults.EnableRDPUDP.ToString()
                                        $GWEnableClientManagerPort                      = $GWDefaults.EnableClientManagerPort.ToString()                                           $GatewayEnableDeviceManagerPort                      = $GatewayDefaults.EnableDeviceManagerPort.ToString()
                                        $GWClientManagerPort                            = "20009"                                           $GatewayDeviceManagerPort                            = "20009"
                                        $GWEnableRDPDOSAttackFilter                     = $GWDefaults.DOSPro.ToString()                                           $GatewayEnableRDPDOSAttackFilter                     = $GatewayDefaults.DOSPro.ToString()
                                        $GWCipherPreference                             = $GWDefaults.CipherPreference.ToString()                                           $GatewayCipherPreference                             = $GatewayDefaults.CipherPreference.ToString()
 
                                        $GWEnableRASSecureClientGatewayPort             = "True" <>                                         $GatewayEnableRASSecureClientGatewayPort             = "True"
                                        $GWRASSecureClientGatewayPort                   = "80"                                           $GatewayRASSecureClientGatewayPort                   = "80"
                                        $GWEnableRDPPort                                = "False"                                           $GatewayEnableRDPPort                                = "False"
                                        $GWEnableBroadcastRASSecureClientGatewayAddress = "True"                                           $GatewayEnableBroadcastRASSecureClientGatewayAddress = "True"
                                        $GWEnableRDPUPDDataTunneling                    = "True"                                           $GatewayEnableRDPUPDDataTunneling                    = "True"
                                        $GWEnableClientManagerPort                      = "True"                                           $GatewayEnableDeviceManagerPort                      = "True"
                                        $GWClientManagerPort                            = "20009"                                           $GatewayDeviceManagerPort                            = "20009"
                                        $GWEnableRDPDOSAttackFilter                     = "True"                                           $GatewayEnableRDPDOSAttackFilter                     = "True"
                                        $GWCipherPreference                             = "True"                                           $GatewayCipherPreference                             = "True"
 
                                $GWEnableRASSecureClientGatewayPort             = $GW.EnableGWPort.ToString() <>                                 $GatewayEnableRASSecureClientGatewayPort             = $Gateway.EnableGatewayPort.ToString()
                                $GWRASSecureClientGatewayPort                   = $GW.GWPort.ToString()                                   $GatewayRASSecureClientGatewayPort                   = $Gateway.GatewayPort.ToString()
                                $GWEnableRDPPort                                = $GW.EnableRDP.ToString()                                   $GatewayEnableRDPPort                                = $Gateway.EnableRDP.ToString()
                                $GWRDPPort                                      = $GW.RDPPort.ToString()                                   $GatewayRDPPort                                      = $Gateway.RDPPort.ToString()
                                $GWEnableBroadcastRASSecureClientGatewayAddress = $GW.Broadcast.ToString()                                   $GatewayEnableBroadcastRASSecureClientGatewayAddress = $Gateway.Broadcast.ToString()
                                $GWEnableRDPUPDDataTunneling                    = $GW.EnableRDPUDP.ToString()                                   $GatewayEnableRDPUPDDataTunneling                    = $Gateway.EnableRDPUDP.ToString()
                                $GWEnableClientManagerPort                      = $GW.EnableClientManagerPort.ToString()                                   $GatewayEnableDeviceManagerPort                      = $Gateway.EnableDeviceManagerPort.ToString()
                                $GWClientManagerPort                            = "20009"                                   $GatewayDeviceManagerPort                            = "20009"
                                $GWEnableRDPDOSAttackFilter                     = $GW.DOSPro.ToString()                                   $GatewayEnableRDPDOSAttackFilter                     = $Gateway.DOSPro.ToString()
                                $GWCipherPreference                             = $GW.CipherPreference.ToString()                                   $GatewayCipherPreference                             = $Gateway.CipherPreference.ToString()
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $GW.InheritDefaultNetworkSettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $Gateway.InheritDefaultNetworkSettings.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable RAS Secure Client Gateway Port"; Value = $GWEnableRASSecureClientGatewayPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable RAS Secure Client Gateway Port"; Value = $GatewayEnableRASSecureClientGatewayPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "RAS Secure Client Gateway Port"; Value = $GWRASSecureClientGatewayPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "RAS Secure Client Gateway Port"; Value = $GatewayRASSecureClientGatewayPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable RDP Port"; Value = $GWEnableRDPPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable RDP Port"; Value = $GatewayEnableRDPPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "RDP Port"; Value = $GWRDPPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "RDP Port"; Value = $GatewayRDPPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable Broadcast RAS Secure Client Gateway Address"; Value = $GWEnableBroadcastRASSecureClientGatewayAddress; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable Broadcast RAS Secure Client Gateway Address"; Value = $GatewayEnableBroadcastRASSecureClientGatewayAddress; }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable RDP UDP Data Tunneling"; Value = $GWEnableRDPUPDDataTunneling; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable RDP UDP Data Tunneling"; Value = $GatewayEnableRDPUPDDataTunneling; }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable Client Manager Port"; Value = $GWEnableClientManagerPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable Client Manager Port"; Value = $GatewayEnableDeviceManagerPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "Client Manager Port"; Value = $GWClientManagerPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "Client Manager Port"; Value = $GatewayDeviceManagerPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable RDP DOS Attack Filter"; Value = $GWEnableRDPDOSAttackFilter; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable RDP DOS Attack Filter"; Value = $GatewayEnableRDPDOSAttackFilter; }) > $Null
 
                                Line 3 "Inherit default settings`t`t: " $GW.InheritDefaultNetworkSettings.ToString() <>                                 Line 3 "Inherit default settings`t`t: " $Gateway.InheritDefaultNetworkSettings.ToString()
                                Line 3 "Enable RAS Secure Client Gateway Port`t: " $GWEnableRASSecureClientGatewayPort                                   Line 3 "Enable RAS Secure Client Gateway Port`t: " $GatewayEnableRASSecureClientGatewayPort
                                Line 3 "RAS Secure Client Gateway Port`t`t: " $GWRASSecureClientGatewayPort                                   Line 3 "RAS Secure Client Gateway Port`t`t: " $GatewayRASSecureClientGatewayPort
                                Line 3 "Enable RDP Port`t`t`t`t: " $GWEnableRDPPort                                   Line 3 "Enable RDP Port`t`t`t`t: " $GatewayEnableRDPPort
                                Line 3 "RDP Port`t`t`t`t: " $GWRDPPort                                   Line 3 "RDP Port`t`t`t`t: " $GatewayRDPPort
 
                                Line 3 "Client Gateway Address`t`t`t: " $GWEnableBroadcastRASSecureClientGatewayAddress <>                                 Line 3 "Client Gateway Address`t`t`t: " $GatewayEnableBroadcastRASSecureClientGatewayAddress
                                Line 3 "Enable RDP UDP Data Tunneling`t`t: " $GWEnableRDPUPDDataTunneling                                   Line 3 "Enable RDP UDP Data Tunneling`t`t: " $GatewayEnableRDPUPDDataTunneling
                                Line 3 "Enable Client Manager Port`t`t: " $GWEnableClientManagerPort                                   Line 3 "Enable Client Manager Port`t`t: " $GatewayEnableDeviceManagerPort
                                Line 3 "Client Manager Port`t`t`t: " $GWClientManagerPort                                   Line 3 "Client Manager Port`t`t`t: " $GatewayDeviceManagerPort
                                Line 3 "Enable RDP DOS Attack Filter`t`t: " $GWEnableRDPDOSAttackFilter                                   Line 3 "Enable RDP DOS Attack Filter`t`t: " $GatewayEnableRDPDOSAttackFilter
 
                                $columnHeaders = @("Inherit default settings",($Script:htmlsb),$GW.InheritDefaultNetworkSettings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Inherit default settings",($Script:htmlsb),$Gateway.InheritDefaultNetworkSettings.ToString(),$htmlwhite)
                                $rowdata += @(,("Enable RAS Secure Client Gateway Port",($Script:htmlsb),$GWEnableRASSecureClientGatewayPort,$htmlwhite))                                   $rowdata += @(,("Enable RAS Secure Client Gateway Port",($Script:htmlsb),$GatewayEnableRASSecureClientGatewayPort,$htmlwhite))
                                $rowdata += @(,("RAS Secure Client Gateway Port",($Script:htmlsb),$GWRASSecureClientGatewayPort,$htmlwhite))                                   $rowdata += @(,("RAS Secure Client Gateway Port",($Script:htmlsb),$GatewayRASSecureClientGatewayPort,$htmlwhite))
                                $rowdata += @(,("Enable RDP Port",($Script:htmlsb),$GWEnableRDPPort,$htmlwhite))                                   $rowdata += @(,("Enable RDP Port",($Script:htmlsb),$GatewayEnableRDPPort,$htmlwhite))
                                $rowdata += @(,("RDP Port",($Script:htmlsb),$GWRDPPort,$htmlwhite))                                   $rowdata += @(,("RDP Port",($Script:htmlsb),$GatewayRDPPort,$htmlwhite))
                                $rowdata += @(,("Enable Broadcast RAS Secure Client Gateway Address",($Script:htmlsb),$GWEnableBroadcastRASSecureClientGatewayAddress,$htmlwhite))                                   $rowdata += @(,("Enable Broadcast RAS Secure Client Gateway Address",($Script:htmlsb),$GatewayEnableBroadcastRASSecureClientGatewayAddress,$htmlwhite))
                                $rowdata += @(,("Enable RDP UDP Data Tunneling",($Script:htmlsb),$GWEnableRDPUPDDataTunneling,$htmlwhite))                                   $rowdata += @(,("Enable RDP UDP Data Tunneling",($Script:htmlsb),$GatewayEnableRDPUPDDataTunneling,$htmlwhite))
                                $rowdata += @(,("Enable Client Manager Port",($Script:htmlsb),$GWEnableClientManagerPort,$htmlwhite))                                   $rowdata += @(,("Enable Client Manager Port",($Script:htmlsb),$GatewayEnableDeviceManagerPort,$htmlwhite))
                                $rowdata += @(,("Client Manager Port",($Script:htmlsb),$GWClientManagerPort,$htmlwhite))                                   $rowdata += @(,("Client Manager Port",($Script:htmlsb),$GatewayDeviceManagerPort,$htmlwhite))
                                $rowdata += @(,("Enable RDP DOS Attack Filter",($Script:htmlsb),$GWEnableRDPDOSAttackFilter,$htmlwhite))                                   $rowdata += @(,("Enable RDP DOS Attack Filter",($Script:htmlsb),$GatewayEnableRDPDOSAttackFilter,$htmlwhite))
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $GW.InheritDefaultSslTlsSettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $Gateway.InheritDefaultSslTlsSettings.ToString(); }) > $Null
 
                                If($GWEnableHSTS -eq "False") <>                                 If($GatewayEnableHSTS -eq "False")
 
                                        $ScriptInformation.Add(@{Data = "Enforce HTTP strict transport security (HSTS)"; Value = $GWEnableHSTS; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Enforce HTTP strict transport security (HSTS)"; Value = $GatewayEnableHSTS; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Browser caache time"; Value = "$GWHSTSMaxage months"; }) > $Null                                           $ScriptInformation.Add(@{Data = "Browser caache time"; Value = "$GatewayHSTSMaxage months"; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Include subdomains"; Value = $GWHSTSIncludeSubdomains; }) > $Null                                           $ScriptInformation.Add(@{Data = "Include subdomains"; Value = $GatewayHSTSIncludeSubdomains; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Preload"; Value = $GWHSTSPreload; }) > $Null                                           $ScriptInformation.Add(@{Data = "Preload"; Value = $GatewayHSTSPreload; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "Enable SSL"; Value = $GWEnableSSL; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Enable SSL"; Value = $GatewayEnableSSL; }) > $Null
                                $ScriptInformation.Add(@{Data = "on Port"; Value = $GWEnableSSLOnPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "on Port"; Value = $GatewayEnableSSLOnPort; }) > $Null
                                $ScriptInformation.Add(@{Data = "Accepted SSL Versions"; Value = $GWAcceptedSSLVersions; }) > $Null                                   $ScriptInformation.Add(@{Data = "Accepted SSL Versions"; Value = $GatewayAcceptedSSLVersions; }) > $Null
                                $ScriptInformation.Add(@{Data = "Cipher Strength"; Value = $GWCipherStrength; }) > $Null                                   $ScriptInformation.Add(@{Data = "Cipher Strength"; Value = $GatewayCipherStrength; }) > $Null
                                $ScriptInformation.Add(@{Data = "Cipher"; Value = $GWCipher; }) > $Null                                   $ScriptInformation.Add(@{Data = "Cipher"; Value = $GatewayCipher; }) > $Null
                                $ScriptInformation.Add(@{Data = "Use ciphers according to server preference"; Value = $GWCipherPreference; }) > $Null                                   $ScriptInformation.Add(@{Data = "Use ciphers according to server preference"; Value = $GatewayCipherPreference; }) > $Null
                                $ScriptInformation.Add(@{Data = "Certificates"; Value = $GWCertificates; }) > $Null                                   $ScriptInformation.Add(@{Data = "Certificates"; Value = $GatewayCertificates; }) > $Null
 
                                Line 3 "Inherit default settings`t`t  : " $GW.InheritDefaultSslTlsSettings.ToString() <>                                 Line 3 "Inherit default settings`t`t  : " $Gateway.InheritDefaultSslTlsSettings.ToString()
 
                                If($GWEnableHSTS -eq "False") <>                                 If($GatewayEnableHSTS -eq "False")
 
                                        Line 3 "Enforce HTTP strict transport security`t  : " $GWEnableHSTS <>                                         Line 3 "Enforce HTTP strict transport security`t  : " $GatewayEnableHSTS
                                        Line 3 "Browser caache time`t`t`t  : " "$GWHSTSMaxage months"                                           Line 3 "Browser caache time`t`t`t  : " "$GatewayHSTSMaxage months"
                                        Line 3 "Include subdomains`t`t`t  : " $GWHSTSIncludeSubdomains                                           Line 3 "Include subdomains`t`t`t  : " $GatewayHSTSIncludeSubdomains
                                        Line 3 "Preload`t`t`t`t`t  : " $GWHSTSPreload                                           Line 3 "Preload`t`t`t`t`t  : " $GatewayHSTSPreload
 
                                Line 3 "Enable SSL`t`t`t`t  : " $GWEnableSSL <>                                 Line 3 "Enable SSL`t`t`t`t  : " $GatewayEnableSSL
                                Line 3 "on Port`t`t`t`t`t  : " $GWEnableSSLOnPort                                   Line 3 "on Port`t`t`t`t`t  : " $GatewayEnableSSLOnPort
                                Line 3 "Accepted SSL Versions`t`t`t  : " $GWAcceptedSSLVersions                                   Line 3 "Accepted SSL Versions`t`t`t  : " $GatewayAcceptedSSLVersions
                                Line 3 "Cipher Strength`t`t`t`t  : " $GWCipherStrength                                   Line 3 "Cipher Strength`t`t`t`t  : " $GatewayCipherStrength
                                Line 3 "Cipher`t`t`t`t`t  : " $GWCipher                                   Line 3 "Cipher`t`t`t`t`t  : " $GatewayCipher
                                Line 3 "Use ciphers according to server preference: " $GWCipherPreference                                   Line 3 "Use ciphers according to server preference: " $GatewayCipherPreference
                                Line 3 "Certificates`t`t`t`t  : " $GWCertificates                                   Line 3 "Certificates`t`t`t`t  : " $GatewayCertificates
 
                                $columnHeaders = @("Inherit default settings",($Script:htmlsb),$GW.InheritDefaultSslTlsSettings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Inherit default settings",($Script:htmlsb),$Gateway.InheritDefaultSslTlsSettings.ToString(),$htmlwhite)
 
                                If($GWEnableHSTS -eq "False") <>                                 If($GatewayEnableHSTS -eq "False")
 
                                        $rowdata += @(,("Enforce HTTP strict transport security (HSTS)",($Script:htmlsb),$GWEnableHSTS,$htmlwhite)) <>                                         $rowdata += @(,("Enforce HTTP strict transport security (HSTS)",($Script:htmlsb),$GatewayEnableHSTS,$htmlwhite))
                                        $rowdata += @(,("Browser caache time",($Script:htmlsb),"$GWHSTSMaxage months",$htmlwhite))                                           $rowdata += @(,("Browser caache time",($Script:htmlsb),"$GatewayHSTSMaxage months",$htmlwhite))
                                        $rowdata += @(,("Include subdomains",($Script:htmlsb),$GWHSTSIncludeSubdomains,$htmlwhite))                                           $rowdata += @(,("Include subdomains",($Script:htmlsb),$GatewayHSTSIncludeSubdomains,$htmlwhite))
                                        $rowdata += @(,("Preload",($Script:htmlsb),$GWHSTSPreload,$htmlwhite))                                           $rowdata += @(,("Preload",($Script:htmlsb),$GatewayHSTSPreload,$htmlwhite))
 
                                $rowdata += @(,("Enable SSL",($Script:htmlsb),$GWEnableSSL,$htmlwhite)) <>                                 $rowdata += @(,("Enable SSL",($Script:htmlsb),$GatewayEnableSSL,$htmlwhite))
                                $rowdata += @(,("on Port",($Script:htmlsb),$GWEnableSSLOnPort,$htmlwhite))                                   $rowdata += @(,("on Port",($Script:htmlsb),$GatewayEnableSSLOnPort,$htmlwhite))
                                $rowdata += @(,("Accepted SSL Versions",($Script:htmlsb),$GWAcceptedSSLVersions,$htmlwhite))                                   $rowdata += @(,("Accepted SSL Versions",($Script:htmlsb),$GatewayAcceptedSSLVersions,$htmlwhite))
                                $rowdata += @(,("Cipher Strength",($Script:htmlsb),$GWCipherStrength,$htmlwhite))                                   $rowdata += @(,("Cipher Strength",($Script:htmlsb),$GatewayCipherStrength,$htmlwhite))
                                $rowdata += @(,("Cipher",($Script:htmlsb),$GWCipher,$htmlwhite))                                   $rowdata += @(,("Cipher",($Script:htmlsb),$GatewayCipher,$htmlwhite))
                                $rowdata += @(,("Use ciphers according to server preference",($Script:htmlsb),$GWCipherPreference,$htmlwhite))                                   $rowdata += @(,("Use ciphers according to server preference",($Script:htmlsb),$GatewayCipherPreference,$htmlwhite))
                                $rowdata += @(,("Certificates",($Script:htmlsb),$GWCertificates,$htmlwhite))                                   $rowdata += @(,("Certificates",($Script:htmlsb),$GatewayCertificates,$htmlwhite))
 
                                WriteWordLine 4 0 "HTML5" <>                                 WriteWordLine 4 0 "User Portal"
 
                                Line 2 "HTML5" <>                                 Line 2 "User Portal"
 
                        If($GW.InheritDefaultHTML5Settings) <>                         If($Gateway.InheritDefaultUserPortalSettings)
 
                                $GWDefaults = Get-RASGWDefaultSettings -SiteId $Site.Id -EA 0 4>$Null <>                                 $GatewayDefaults = Get-RASGatewayDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
 
                                If($? -and $Null -ne $GWDefaults) <>                                 If($? -and $Null -ne $GatewayDefaults)
 
                                        $GWEnableHTML5Client = $GWDefaults.EnableHTML5.ToString() <>                                         $GatewayEnableUserPortalClient = $GatewayDefaults.EnableUserPortal.ToString()
 
                                        Switch($GWDefaults.LaunchMethod) <>                                         Switch($GatewayDefaults.LaunchMethod)
 
                                                "ParallelsClientAndHTML5"       {$GWLaunchSessionsUsing = "Launch apps with Parallels Client & Fallback to HTML5"; Break} <>                                                 "ParallelsClientAndWebClient"   {$GatewayLaunchSessionsUsing = "Parallels Client with fallback to Browser"; Break}
                                                "ParallelsClient"                       {$GWLaunchSessionsUsing = "Launch apps with Parallels Client"; Break}                                                   "ParallelsClient"                               {$GatewayLaunchSessionsUsing = "Parallels Client only"; Break}
                                                "HTML5"                                         {$GWLaunchSessionsUsing = "Launch apps in Browser only (HTML5 Only)"; Break}                                                   "WebClient"                                             {$GatewayLaunchSessionsUsing = "Browser Only"; Break}
                                                Default                                         {$GWLaunchSessionsUsing = "Unable to determine Launch sessions using: $($GWDefaults.LaunchMethod)"; Break}                                                   Default                                                 {$GatewayLaunchSessionsUsing = "Unable to determine Launch sessions using: $($GatewayDefaults.LaunchMethod)"; Break}
 
                                        Switch ($GWDefaults.FileTransferMode) <>                                         Switch ($GatewayDefaults.FileTransferMode)
 
                                                "Bidirectional"         {$GWFileTransferMode = "Bidirectional"; Break} <>                                                 "Bidirectional"         {$GatewayFileTransferMode = "Bidirectional"; Break}
                                                "Disabled"                      {$GWFileTransferMode = "Disabled"; Break}                                                   "Disabled"                      {$GatewayFileTransferMode = "Disabled"; Break}
                                                "ClientToServer"        {$GWFileTransferMode = "Client to server only"; Break}                                                   "ClientToServer"        {$GatewayFileTransferMode = "Client to server only"; Break}
                                                "ServerToClient"        {$GWFileTransferMode = "Server to client only"; Break}                                                   "ServerToClient"        {$GatewayFileTransferMode = "Server to client only"; Break}
                                                Default                         {$GWFileTransferMode = "Unable to determine File Transfer mode: $($GWDefaults.FileTransferMode)"; Break}                                                   Default                         {$GatewayFileTransferMode = "Unable to determine File Transfer mode: $($GatewayDefaults.FileTransferMode)"; Break}
 
                                        Switch ($GWDefaults.ClipboardDirection) <>                                         Switch ($GatewayDefaults.ClipboardDirection)
 
                                                "Bidirectional"         {$GWClipboardTransferMode = "Bidirectional"; Break} <>                                                 "Bidirectional"         {$GatewayClipboardTransferMode = "Bidirectional"; Break}
                                                "Disabled"                      {$GWClipboardTransferMode = "Disabled"; Break}                                                   "Disabled"                      {$GatewayClipboardTransferMode = "Disabled"; Break}
                                                "ClientToServer"        {$GWClipboardTransferMode = "Client to server only"; Break}                                                   "ClientToServer"        {$GatewayClipboardTransferMode = "Client to server only"; Break}
                                                "ServerToClient"        {$GWClipboardTransferMode = "Server to client only"; Break}                                                   "ServerToClient"        {$GatewayClipboardTransferMode = "Server to client only"; Break}
                                                Default                         {$GWClipboardTransferMode = "Unable to determine Clipboard mode: $($GWDefaults.ClipboardDirection)"; Break}                                                   Default                         {$GatewayClipboardTransferMode = "Unable to determine Clipboard mode: $($GatewayDefaults.ClipboardDirection)"; Break}
 
                                        $GWAllowLaunchMethod          = $GWDefaults.AllowLaunchMethod.ToString() <>                                         $GatewayAllowLaunchMethod          = $GatewayDefaults.AllowLaunchMethod.ToString()
                                        $GWAllowAppsInNewTab          = $GWDefaults.AllowAppsInNewTab.ToString()                                           $GatewayAllowAppsInNewTab          = $GatewayDefaults.AllowAppsInNewTab.ToString()
                                        $GWUsePreWin2000LoginFormat   = $GWDefaults.UsePreWin2000LoginFormat.ToString()                                           $GatewayUsePreWin2000LoginFormat   = $GatewayDefaults.UsePreWin2000LoginFormat.ToString()
                                        $GWAllowEmbed                 = $GWDefaults.AllowEmbed.ToString()                                           $GatewayAllowEmbed                 = $GatewayDefaults.AllowEmbed.ToString()
                                        $GWAllowFileTransfer          = $GWDefaults.AllowFileTransfer.ToString()                                           $GatewayAllowFileTransfer          = $GatewayDefaults.AllowFileTransfer.ToString()
                                        $GWAllowClipboard             = $GWDefaults.AllowClipboard.ToString()                                           $GatewayAllowClipboard             = $GatewayDefaults.AllowClipboard.ToString()
                                        $GWAllowCORS                  = $GWDefaults.AllowCORS                                           $GatewayAllowCORS                  = $GatewayDefaults.AllowCORS
                                        $GWAllowedDomainsForCORS      = $GWDefaults.AllowedDomainsForCORS                                           $GatewayAllowedDomainsForCORS      = $GatewayDefaults.AllowedDomainsForCORS
                                        $GWBrowserCacheTimeInMonths   = $GWDefaults.BrowserCacheTimeInMonths                                           $GatewayBrowserCacheTimeInMonths   = $GatewayDefaults.BrowserCacheTimeInMonths
                                        $GWEnableAlternateNLBHostname = $GWDefaults.EnableAlternateNLBHost.ToString()                                           $GatewayEnableAlternateNLBHostname = $GatewayDefaults.EnableAlternateNLBHost.ToString()
                                        $GWAlternameNLBHostname       = $GWDefaults.AlternateNLBHost                                           $GatewayAlternameNLBHostname       = $GatewayDefaults.AlternateNLBHost
                                        $GWEnableAlternateNLBPort     = $GWDefaults.EnableAlternateNLBPort.ToString()                                           $GatewayEnableAlternateNLBPort     = $GatewayDefaults.EnableAlternateNLBPort.ToString()
                                        $GWAlternateNLBPort           = $GWDefaults.AlternateNLBPort.ToString()                                           $GatewayAlternateNLBPort           = $GatewayDefaults.AlternateNLBPort.ToString()
 
                                        $GWEnableHTML5Client          = "True" <>                                         $GatewayEnableUserPortalClient     = "True"
                                        $GWLaunchSessionsUsing        = "Launch apps with Parallels CLient & Fallback to HTML5"                                           $GatewayLaunchSessionsUsing        = "Parallels Client with gallback to Browser"
                                        $GWAllowLaunchMethod          = "True"                                           $GatewayAllowLaunchMethod          = "True"
                                        $GWAllowAppsInNewTab          = "False"                                           $GatewayAllowAppsInNewTab          = "False"
                                        $GWUsePreWin2000LoginFormat   = "True"                                           $GatewayUsePreWin2000LoginFormat   = "True"
                                        $GWAllowEmbed                 = "False"                                           $GatewayAllowEmbed                 = "False"
                                        $GWAllowFileTransfer          = "True"                                           $GatewayAllowFileTransfer          = "True"
                                        $GWAllowClipboard             = "True"                                           $GatewayAllowClipboard             = "True"
                                        $GWAllowCORS                  = "False"                                           $GatewayAllowCORS                  = "False"
                                        $GWAllowedDomainsForCORS      = @()                                           $GatewayAllowedDomainsForCORS      = @()
                                        $GWBrowserCacheTimeInMonths   = 12                                           $GatewayBrowserCacheTimeInMonths   = 12
                                        $GWEnableAlternateNLBHostname = "False"                                           $GatewayEnableAlternateNLBHostname = "False"
                                        $GWAlternameNLBHostname       = ""                                           $GatewayAlternameNLBHostname       = ""
                                        $GWEnableAlternateNLBPort     = "False"                                           $GatewayEnableAlternateNLBPort     = "False"
                                        $GWAlternateNLBPort           = "8443"                                           $GatewayAlternateNLBPort           = "8443"
                                        $GWClipboardTransferMode      = "Bidirectional"                                           $GatewayClipboardTransferMode      = "Bidirectional"
                                        $GWClipboardTransferMode      = "Bidirectional"    
 
                                $GWEnableHTML5Client = $GW.EnableHTML5.ToString() <>                                 $GatewayEnableUserPortalClient = $Gateway.EnableUserPortal.ToString()
 
                                Switch($GW.LaunchMethod) <>                                 Switch($GatewayDefaults.LaunchMethod)
 
                                        "ParallelsClientAndHTML5"       {$GWLaunchSessionsUsing = "Launch apps with Parallels Client & Fallback to HTML5"; Break} <>                                         "ParallelsClientAndWebClient"   {$GatewayLaunchSessionsUsing = "Parallels Client with fallback to Browser"; Break}
                                        "ParallelsClient"                       {$GWLaunchSessionsUsing = "Launch apps with Parallels Client"; Break}                                           "ParallelsClient"                               {$GatewayLaunchSessionsUsing = "Parallels Client only"; Break}
                                        "HTML5"                                         {$GWLaunchSessionsUsing = "Launch apps in Browser only (HTML5 Only)"; Break}                                           "WebClient"                                             {$GatewayLaunchSessionsUsing = "Browser Only"; Break}
                                        Default                                         {$GWLaunchSessionsUsing = "Unable to determine Launch sessions using: $($GW.LaunchMethod)"; Break}                                           Default                                                 {$GatewayLaunchSessionsUsing = "Unable to determine Launch sessions using: $($GatewayDefaults.LaunchMethod)"; Break}
 
                                Switch ($GW.FileTransferMode) <>                                 Switch ($GatewayDefaults.FileTransferMode)
 
                                        "Bidirectional"         {$GWFileTransferMode = "Bidirectional"; Break} <>                                         "Bidirectional"         {$GatewayFileTransferMode = "Bidirectional"; Break}
                                        "Disabled"                      {$GWFileTransferMode = "Disabled"; Break}                                           "Disabled"                      {$GatewayFileTransferMode = "Disabled"; Break}
                                        "ClientToServer"        {$GWFileTransferMode = "Client to server only"; Break}                                           "ClientToServer"        {$GatewayFileTransferMode = "Client to server only"; Break}
                                        "ServerToClient"        {$GWFileTransferMode = "Server to client only"; Break}                                           "ServerToClient"        {$GatewayFileTransferMode = "Server to client only"; Break}
                                        Default                         {$GWFileTransferMode = "Unable to determine File Transfer mode: $($GW.FileTransferMode)"; Break}                                           Default                         {$GatewayFileTransferMode = "Unable to determine File Transfer mode: $($GatewayDefaults.FileTransferMode)"; Break}
 
                                Switch ($GW.ClipboardDirection) <>                                 Switch ($GatewayDefaults.ClipboardDirection)
 
                                        "Bidirectional"         {$GWClipboardTransferMode = "Bidirectional"; Break} <>                                         "Bidirectional"         {$GatewayClipboardTransferMode = "Bidirectional"; Break}
                                        "Disabled"                      {$GWClipboardTransferMode = "Disabled"; Break}                                           "Disabled"                      {$GatewayClipboardTransferMode = "Disabled"; Break}
                                        "ClientToServer"        {$GWClipboardTransferMode = "Client to server only"; Break}                                           "ClientToServer"        {$GatewayClipboardTransferMode = "Client to server only"; Break}
                                        "ServerToClient"        {$GWClipboardTransferMode = "Server to client only"; Break}                                           "ServerToClient"        {$GatewayClipboardTransferMode = "Server to client only"; Break}
                                        Default                         {$GWClipboardTransferMode = "Unable to determine Clipboard mode: $($GW.ClipboardDirection)"; Break}                                           Default                         {$GatewayClipboardTransferMode = "Unable to determine Clipboard mode: $($GatewayDefaults.ClipboardDirection)"; Break}
 
                                $GWAllowLaunchMethod          = $GW.AllowLaunchMethod.ToString() <>                                 $GatewayAllowLaunchMethod          = $Gateway.AllowLaunchMethod.ToString()
                                $GWAllowAppsInNewTab          = $GW.AllowAppsInNewTab.ToString()                                   $GatewayAllowAppsInNewTab          = $Gateway.AllowAppsInNewTab.ToString()
                                $GWUsePreWin2000LoginFormat   = $GW.UsePreWin2000LoginFormat.ToString()                                   $GatewayUsePreWin2000LoginFormat   = $Gateway.UsePreWin2000LoginFormat.ToString()
                                $GWAllowEmbed                 = $GW.AllowEmbed.ToString()                                   $GatewayAllowEmbed                 = $Gateway.AllowEmbed.ToString()
                                $GWAllowFileTransfer          = $GW.AllowFileTransfer                                   $GatewayAllowFileTransfer          = $Gateway.AllowFileTransfer
                                $GWAllowClipboard             = $GW.AllowClipboard                                   $GatewayAllowClipboard             = $Gateway.AllowClipboard
                                $GWAllowCORS                  = $GW.AllowCORS                                   $GatewayAllowCORS                  = $Gateway.AllowCORS
                                $GWAllowedDomainsForCORS      = $GW.AllowedDomainsForCORS                                   $GatewayAllowedDomainsForCORS      = $Gateway.AllowedDomainsForCORS
                                $GWBrowserCacheTimeInMonths   = $GW.BrowserCacheTimeInMonths                                   $GatewayBrowserCacheTimeInMonths   = $Gateway.BrowserCacheTimeInMonths
                                $GWEnableAlternateNLBHostname = $GW.EnableAlternateNLBHost.ToString()                                   $GatewayEnableAlternateNLBHostname = $Gateway.EnableAlternateNLBHost.ToString()
                                $GWAlternameNLBHostname       = $GW.AlternateNLBHost                                   $GatewayAlternameNLBHostname       = $Gateway.AlternateNLBHost
                                $GWEnableAlternateNLBPort     = $GW.EnableAlternateNLBPort.ToString()                                   $GatewayEnableAlternateNLBPort     = $Gateway.EnableAlternateNLBPort.ToString()
                                $GWAlternateNLBPort           = $GW.AlternateNLBPort.ToString()                                   $GatewayAlternateNLBPort           = $Gateway.AlternateNLBPort.ToString()
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $GW.InheritDefaultHTML5Settings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $Gateway.InheritDefaultUserPortalSettings.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable HTML5 Client"; Value = $GWEnableHTML5Client; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable User Portal"; Value = $GatewayEnableUserPortalClient; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Launch sessions using"; Value = $GWLaunchSessionsUsing; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Launch sessions using"; Value = $GatewayLaunchSessionsUsing; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Allow user to select a launch method"; Value = $GWAllowLaunchMethod; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Allow user to select a launch method"; Value = $GatewayAllowLaunchMethod; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Allow opening applications in a new tab"; Value = $GWAllowAppsInNewTab; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Allow opening applications in a new tab"; Value = $GatewayAllowAppsInNewTab; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Use Pre Windows 2000 login format"; Value = $GWUsePreWin2000LoginFormat; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Use Pre Windows 2000 login format"; Value = $GatewayUsePreWin2000LoginFormat; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Allow embedding of Parallels HTML5 Client into other web pages"; Value = $GWAllowEmbed; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Allow embedding of User Portal into other web pages"; Value = $GatewayAllowEmbed; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Allow file transfer command"; Value = $GWAllowFileTransfer.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Allow file transfer command"; Value = $GatewayAllowFileTransfer.ToString(); }) > $Null
                                If($GWAllowFileTransfer)                                   If($GatewayAllowFileTransfer)
 
                                        $ScriptInformation.Add(@{Data = "          Direction"; Value = $GWFileTransferMode; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "          Direction"; Value = $GatewayFileTransferMode; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Allow clipboard command"; Value = $GWAllowClipboard.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Allow clipboard command"; Value = $GatewayAllowClipboard.ToString(); }) > $Null
                                If($GWAllowClipboard)                                   If($GatewayAllowClipboard)
 
                                        $ScriptInformation.Add(@{Data = "          Clipboard Redirection"; Value = $GWClipboardTransferMode; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "          Clipboard Redirection"; Value = $GatewayClipboardTransferMode; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Allow cross-origin resource sharing"; Value = $GWAllowCORS.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Allow cross-origin resource sharing"; Value = $GatewayAllowCORS.ToString(); }) > $Null
                                If($GWAllowCORS)                                   If($GatewayAllowCORS)
 
                                        ForEach($Domain in $GWAllowedDomainsForCORS) <>                                         ForEach($Domain in $GatewayAllowedDomainsForCORS)
 
                                        $ScriptInformation.Add(@{Data = "     Browser cache time"; Value = "$($GWBrowserCacheTimeInMonths.ToString()) months"; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "     Browser cache time"; Value = "$($GatewayBrowserCacheTimeInMonths.ToString()) months"; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Use alternate hostname"; Value = $GWEnableAlternateNLBHostname; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Use alternate hostname"; Value = $GatewayEnableAlternateNLBHostname; }) > $Null
                                If($GWEnableAlternateNLBHostname -eq "True")                                   If($GatewayEnableAlternateNLBHostname -eq "True")
 
                                        $ScriptInformation.Add(@{Data = ""; Value = $GWAlternameNLBHostname; }) > $Null <>                                         $ScriptInformation.Add(@{Data = ""; Value = $GatewayAlternameNLBHostname; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Use alternate port"; Value = $GWEnableAlternateNLBPort; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Use alternate port"; Value = $GatewayEnableAlternateNLBPort; }) > $Null
                                If($GWEnableAlternateNLBPort -eq "True")                                   If($GatewayEnableAlternateNLBPort -eq "True")
 
                                        $ScriptInformation.Add(@{Data = ""; Value = $GWAlternateNLBPort; }) > $Null <>                                         $ScriptInformation.Add(@{Data = ""; Value = $GatewayAlternateNLBPort; }) > $Null
 
                                Line 3 "Inherit default settings`t`t`t: " $GW.InheritDefaultHTML5Settings.ToString() <>                                 Line 3 "Inherit default settings`t`t`t: " $Gateway.InheritDefaultUserPortalSettings.ToString()
                                Line 3 "Enable HTML5 Client`t`t`t`t: " $GWEnableHTML5Client                                   Line 3 "Enable User Portal`t`t`t`t: " $GatewayEnableUserPortalClient
 
                                Line 4 "Launch sessions using`t`t`t: " $GWLaunchSessionsUsing <>                                 Line 4 "Launch sessions using`t`t`t: " $GatewayLaunchSessionsUsing
                                Line 4 "Allow user to select a launch method`t: " $GWAllowLaunchMethod                                   Line 4 "Allow user to select a launch method`t: " $GatewayAllowLaunchMethod
                                Line 4 "Allow opening applications in a new tab`t: " $GWAllowAppsInNewTab                                   Line 4 "Allow opening applications in a new tab`t`t: " $GatewayAllowAppsInNewTab
                                Line 4 "Use Pre Windows 2000 login format`t: " $GWUsePreWin2000LoginFormat                                   Line 4 "Use Pre Windows 2000 login format`t: " $GatewayUsePreWin2000LoginFormat
                                Line 4 "Allow embedding of Parallels HTML5"                                   Line 4 "Allow embedding of User Portal"
                                Line 4 "Client into other web pages`t`t: " $GWAllowEmbed                                   Line 4 "into other web pages`t`t: " $GatewayAllowEmbed
 
                                Line 4 "Allow file transfer command`t`t: " $GWAllowFileTransfer.ToString() <>                                 Line 4 "Allow file transfer command`t`t: " $GatewayAllowFileTransfer.ToString()
                                If($GW.AllowFileTransfer)                                   If($Gateway.AllowFileTransfer)
 
                                        Line 5 "Direction: " $GWFileTransferMode <>                                         Line 5 "Direction`t`t`t: " $GatewayFileTransferMode
 
                                Line 4 "Allow clipboard command`t`t`t: " $GWAllowClipboard.ToString() <>                                 Line 4 "Allow clipboard command`t`t`t: " $GatewayAllowClipboard.ToString()
                                If($GW.AllowClipboard)                                   If($Gateway.AllowClipboard)
 
                                        Line 5 "Clipboard Redirection: " $GWClipboardTransferMode <>                                         Line 5 "Clipboard Redirection`t`t: " $GatewayClipboardTransferMode
 
                                Line 4 "Allow cross-origin resource sharing`t: " $GWAllowCORS.ToString() <>                                 Line 4 "Allow cross-origin resource sharing`t: " $GatewayAllowCORS.ToString()
                                If($GWAllowCORS)                                   If($GatewayAllowCORS)
 
                                        ForEach($Domain in $GWAllowedDomainsForCORS) <>                                         ForEach($Domain in $GatewayAllowedDomainsForCORS)
 
                                        Line 6 "Browser cache time      : " "$($GWBrowserCacheTimeInMonths.ToString()) months" <>                                         Line 6 "Browser cache time      : " "$($GatewayBrowserCacheTimeInMonths.ToString()) months"
 
                                Line 4 "Use alternate hostname`t`t: " $GWEnableAlternateNLBHostname <>                                 Line 4 "Use alternate hostname`t`t: " $GatewayEnableAlternateNLBHostname
                                If($GWEnableAlternateNLBHostname -eq "True")                                   If($GatewayEnableAlternateNLBHostname -eq "True")
 
                                        Line 8 $GWAlternameNLBHostname <>                                         Line 8 $GatewayAlternameNLBHostname
 
                                Line 4 "Use alternate port`t`t: " $GWEnableAlternateNLBPort <>                                 Line 4 "Use alternate port`t`t: " $GatewayEnableAlternateNLBPort
                                If($GWEnableAlternateNLBPort -eq "True")                                   If($GatewayEnableAlternateNLBPort -eq "True")
 
                                        Line 8 $GWAlternateNLBPort <>                                         Line 8 $GatewayAlternateNLBPort
 
                                $columnHeaders = @("Inherit default settings",($Script:htmlsb),$GW.InheritDefaultHTML5Settings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Inherit default settings",($Script:htmlsb),$Gateway.InheritDefaultUserPortalSettings.ToString(),$htmlwhite)
                                $rowdata += @(,("Enable HTML5 Client",($Script:htmlsb),$GWEnableHTML5Client,$htmlwhite))                                   $rowdata += @(,("Enable User Portal",($Script:htmlsb),$GatewayEnableUserPortalClient,$htmlwhite))
 
                                $rowdata += @(,("     Launch sessions using",($Script:htmlsb),$GWLaunchSessionsUsing,$htmlwhite)) <>                                 $rowdata += @(,("     Launch sessions using",($Script:htmlsb),$GatewayLaunchSessionsUsing,$htmlwhite))
                                $rowdata += @(,("     Allow user to select a launch method",($Script:htmlsb),$GWAllowLaunchMethod,$htmlwhite))                                   $rowdata += @(,("     Allow user to select a launch method",($Script:htmlsb),$GatewayAllowLaunchMethod,$htmlwhite))
                                $rowdata += @(,("     Allow opening applications in a new tab",($Script:htmlsb),$GWAllowAppsInNewTab,$htmlwhite))                                   $rowdata += @(,("     Allow opening applications in a new tab",($Script:htmlsb),$GatewayAllowAppsInNewTab,$htmlwhite))
                                $rowdata += @(,("     Use Pre Windows 2000 login format",($Script:htmlsb),$GWUsePreWin2000LoginFormat,$htmlwhite))                                   $rowdata += @(,("     Use Pre Windows 2000 login format",($Script:htmlsb),$GatewayUsePreWin2000LoginFormat,$htmlwhite))
                                $rowdata += @(,("     Allow embedding of Parallels HTML5 Client into other web pages",($Script:htmlsb),$GWAllowEmbed,$htmlwhite))                                   $rowdata += @(,("     Allow embedding of User Portal into other web pages",($Script:htmlsb),$GatewayAllowEmbed,$htmlwhite))
 
                                $rowdata += @(,("     Allow file transfer command",($Script:htmlsb),$GWAllowFileTransfer.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("     Allow file transfer command",($Script:htmlsb),$GatewayAllowFileTransfer.ToString(),$htmlwhite))
                                If($GW.AllowFileTransfer)                                   If($Gateway.AllowFileTransfer)
 
                                        $rowdata += @(,("          Direction",($Script:htmlsb),$GWFileTransferMode,$htmlwhite)) <>                                         $rowdata += @(,("          Direction",($Script:htmlsb),$GatewayFileTransferMode,$htmlwhite))
 
                                $rowdata += @(,("     Allow clipboard command",($Script:htmlsb),$GWAllowClipboard.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("     Allow clipboard command",($Script:htmlsb),$GatewayAllowClipboard.ToString(),$htmlwhite))
                                If($GW.AllowClipboard)                                   If($Gateway.AllowClipboard)
 
                                        $rowdata += @(,("          Clipboard Redirection",($Script:htmlsb),$GWClipboardTransferMode,$htmlwhite)) <>                                         $rowdata += @(,("          Clipboard Redirection",($Script:htmlsb),$GatewayClipboardTransferMode,$htmlwhite))
 
                                $rowdata += @(,("     Allow cross-origin resource sharing",($Script:htmlsb),$GWAllowCORS.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("     Allow cross-origin resource sharing",($Script:htmlsb),$GatewayAllowCORS.ToString(),$htmlwhite))
                                If($GWAllowCORS)                                   If($GatewayAllowCORS)
 
                                        ForEach($Domain in $GWAllowedDomainsForCORS) <>                                         ForEach($Domain in $GatewayAllowedDomainsForCORS)
 
                                        $rowdata += @(,("     Browser cache time",($Script:htmlsb),"$($GWBrowserCacheTimeInMonths.ToString()) months",$htmlwhite)) <>                                         $rowdata += @(,("     Browser cache time",($Script:htmlsb),"$($GatewayBrowserCacheTimeInMonths.ToString()) months",$htmlwhite))
 
                                $rowdata += @(,("     Use alternate hostname",($Script:htmlsb),$GWEnableAlternateNLBHostname,$htmlwhite)) <>                                 $rowdata += @(,("     Use alternate hostname",($Script:htmlsb),$GatewayEnableAlternateNLBHostname,$htmlwhite))
                                If($GWEnableAlternateNLBHostname -eq "True")                                   If($GatewayEnableAlternateNLBHostname -eq "True")
 
                                        $rowdata += @(,("",($Script:htmlsb),$GWAlternameNLBHostname,$htmlwhite)) <>                                         $rowdata += @(,("",($Script:htmlsb),$GatewayAlternameNLBHostname,$htmlwhite))
 
                                $rowdata += @(,("     Use alternate port",($Script:htmlsb),$GWEnableAlternateNLBPort,$htmlwhite)) <>                                 $rowdata += @(,("     Use alternate port",($Script:htmlsb),$GatewayEnableAlternateNLBPort,$htmlwhite))
                                If($GWEnableAlternateNLBPort -eq "True")                                   If($GatewayEnableAlternateNLBPort -eq "True")
 
                                        $rowdata += @(,("",($Script:htmlsb),$GWAlternateNLBPort,$htmlwhite)) <>                                         $rowdata += @(,("",($Script:htmlsb),$GatewayAlternateNLBPort,$htmlwhite))
 
                                $msg = "HTML5" <>                                 $msg = "User Portal"
 
                        If($GW.InheritDefaultWyseSettings) <>                         If($Gateway.InheritDefaultWyseSettings)
 
                                $GWDefaults = Get-RASGWDefaultSettings -SiteId $Site.Id -EA 0 4>$Null <>                                 $GatewayDefaults = Get-RASGatewayDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
 
                                If($? -and $Null -ne $GWDefaults) <>                                 If($? -and $Null -ne $GatewayDefaults)
 
                                        $GWEnableWyse          = $GWDefaults.EnableWyseSupport.ToString() <>                                         $GatewayEnableWyse          = $GatewayDefaults.EnableWyseSupport.ToString()
                                        $GWDisableWyseCertWarn = $GWDefaults.DisableWyseCertWarn.ToString()                                           $GatewayDisableWyseCertWarn = $GatewayDefaults.DisableWyseCertWarn.ToString()
 
                                        $GWEnableWyse          = "True" <>                                         $GatewayEnableWyse          = "True"
                                        $GWDisableWyseCertWarn = "False"                                           $GatewayDisableWyseCertWarn = "False"
 
                                $GWEnableWyse          = $GW.EnableWyseSupport.ToString() <>                                 $GatewayEnableWyse          = $Gateway.EnableWyseSupport.ToString()
                                $GWDisableWyseCertWarn = $GW.DisableWyseCertWarn.ToString()                                   $GatewayDisableWyseCertWarn = $Gateway.DisableWyseCertWarn.ToString()
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $GW.InheritDefaultWyseSettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $Gateway.InheritDefaultWyseSettings.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Enable Wyse ThinOS Support"; Value = $GWEnableWyse; }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable Wyse ThinOS Support"; Value = $GatewayEnableWyse; }) > $Null
                                $ScriptInformation.Add(@{Data = "Do not warn if server certificate is not verified"; Value = $GWDisableWyseCertWarn; }) > $Null                                   $ScriptInformation.Add(@{Data = "Do not warn if server certificate is not verified"; Value = $GatewayDisableWyseCertWarn; }) > $Null
 
                                Line 3 "Inherit default settings`t`t`t : " $GW.InheritDefaultWyseSettings.ToString() <>                                 Line 3 "Inherit default settings`t`t`t : " $Gateway.InheritDefaultWyseSettings.ToString()
                                Line 3 "Enable Wyse ThinOS Support`t`t`t : " $GWEnableWyse                                   Line 3 "Enable Wyse ThinOS Support`t`t`t : " $GatewayEnableWyse
                                Line 3 "Do not warn if server certificate is not verified: " $GWDisableWyseCertWarn                                   Line 3 "Do not warn if server certificate is not verified: " $GatewayDisableWyseCertWarn
 
                                $columnHeaders = @("Inherit default settings",($Script:htmlsb),$GW.InheritDefaultWyseSettings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Inherit default settings",($Script:htmlsb),$Gateway.InheritDefaultWyseSettings.ToString(),$htmlwhite)
                                $rowdata += @(,("Enable Wyse ThinOS Support",($Script:htmlsb),$GWEnableWyse,$htmlwhite))                                   $rowdata += @(,("Enable Wyse ThinOS Support",($Script:htmlsb),$GatewayEnableWyse,$htmlwhite))
                                $rowdata += @(,("Do not warn if server certificate is not verified",($Script:htmlsb),$GWDisableWyseCertWarn,$htmlwhite))                                   $rowdata += @(,("Do not warn if server certificate is not verified",($Script:htmlsb),$GatewayDisableWyseCertWarn,$htmlwhite))
 
                        If($GW.InheritDefaultSecuritySettings) <>                         If($Gateway.InheritDefaultSecuritySettings)
 
                                $GWDefaults = Get-RASGWDefaultSettings -SiteId $Site.Id -EA 0 4>$Null <>                                 $GatewayDefaults = Get-RASGatewayDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
 
                                If($? -and $Null -ne $GWDefaults) <>                                 If($? -and $Null -ne $GatewayDefaults)
 
                                        If($GWDefaults.SecurityMode -eq "AllowAllExcept") <>                                         If($GatewayDefaults.SecurityMode -eq "AllowAllExcept")
 
                                                $GWAllow = "AllowAllExcept" <>                                                 $GatewayAllow = "AllowAllExcept"
 
                                                ForEach($Item in $GWDefaults.MACAllowExcept) <>                                                 ForEach($Item in $GatewayDefaults.MACAllowExcept)
 
                                                $GWAllow = "AllowOnly" <>                                                 $GatewayAllow = "AllowOnly"
 
                                                ForEach($Item in $GWDefaults.MACAllowOnly) <>                                                 ForEach($Item in $GatewayDefaults.MACAllowOnly)
 
                                        $GWAllow = "AllowAllExcept" <>                                         $GatewayAllow = "AllowAllExcept"
 
                                If($GW.SecurityMode -eq "AllowAllExcept") <>                                 If($Gateway.SecurityMode -eq "AllowAllExcept")
 
                                        $GWAllow = "AllowAllExcept" <>                                         $GatewayAllow = "AllowAllExcept"
 
                                        ForEach($Item in $GW.MACAllowExcept) <>                                         ForEach($Item in $Gateway.MACAllowExcept)
 
                                        $GWAllow = "AllowOnly" <>                                         $GatewayAllow = "AllowOnly"
 
                                        ForEach($Item in $GW.MACAllowOnly) <>                                         ForEach($Item in $Gateway.MACAllowOnly)
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $GW.InheritDefaultSecuritySettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $Gateway.InheritDefaultSecuritySettings.ToString(); }) > $Null
                                If($GWAllow -eq "AllowAllExcept")                                   If($GatewayAllow -eq "AllowAllExcept")
 
                                Line 3 "Inherit default settings`t`t: " $GW.InheritDefaultSecuritySettings.ToString() <>                                 Line 3 "Inherit default settings`t`t: " $Gateway.InheritDefaultSecuritySettings.ToString()
                                If($GWAllow -eq "AllowAllExcept")                                   If($GatewayAllow -eq "AllowAllExcept")
 
                                $columnHeaders = @("Inherit default settings",($Script:htmlsb),$GW.InheritDefaultSecuritySettings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Inherit default settings",($Script:htmlsb),$Gateway.InheritDefaultSecuritySettings.ToString(),$htmlwhite)
                                If($GWAllow -eq "AllowAllExcept")                                   If($GatewayAllow -eq "AllowAllExcept")
 
                        If($GW.InheritDefaultWebSettings) <>                         If($Gateway.InheritDefaultWebSettings)
 
                                $GWDefaults = Get-RASGWDefaultSettings -SiteId $Site.Id -EA 0 4>$Null <>                                 $GatewayDefaults = Get-RASGatewayDefaultSettings -SiteId $Site.Id -EA 0 4>$Null
 
                                If($? -and $Null -ne $GWDefaults) <>                                 If($? -and $Null -ne $GatewayDefaults)
 
                                        $GWDefaultURL = $GWDefaults.WebRequestsURL <>                                         $GatewayDefaultURL = $GatewayDefaults.WebRequestsURL
                                        $GWWebCookie = $GWDefaults.WebCookie                                           $GatewayWebCookie = $GatewayDefaults.WebCookie
 
                                        $GWDefaultURL = "https://%hostname%/RASHTML5Gateway" <>                                         $GatewayDefaultURL = "https://%hostname%/RASHTML5Gateway"
                                        $GWWebCookie = "ASP.NET_SessionId"                                           $GatewayWebCookie = "ASP.NET_SessionId"
 
                                $GWDefaultURL = $GW.WebRequestsURL <>                                 $GatewayDefaultURL = $Gateway.WebRequestsURL
                                $GWWebCookie = $GW.WebCookie                                   $GatewayWebCookie = $Gateway.WebCookie
 
                                $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $GW.InheritDefaultWebSettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Inherit default settings"; Value = $Gateway.InheritDefaultWebSettings.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Default URL"; Value = $GWDefaultURL; }) > $Null                                   $ScriptInformation.Add(@{Data = "Default URL"; Value = $GatewayDefaultURL; }) > $Null
                                $ScriptInformation.Add(@{Data = "Web cookie"; Value = $GWWebCookie; }) > $Null                                   $ScriptInformation.Add(@{Data = "Web cookie"; Value = $GatewayWebCookie; }) > $Null
 
                                Line 3 "Inherit default settings`t`t: " $GW.InheritDefaultWebSettings.ToString() <>                                 Line 3 "Inherit default settings`t`t: " $Gateway.InheritDefaultWebSettings.ToString()
                                Line 3 "Default URL`t`t`t`t: " $GWDefaultURL                                   Line 3 "Default URL`t`t`t`t: " $GatewayDefaultURL
                                Line 3 "Web cookie`t`t`t`t: " $GWWebCookie                                   Line 3 "Web cookie`t`t`t`t: " $GatewayWebCookie
 
                                $columnHeaders = @("Inherit default settings",($Script:htmlsb),$GW.InheritDefaultWebSettings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Inherit default settings",($Script:htmlsb),$Gateway.InheritDefaultWebSettings.ToString(),$htmlwhite)
                                $rowdata += @(,("Default URL",($Script:htmlsb),$GWDefaultURL,$htmlwhite))                                   $rowdata += @(,("Default URL",($Script:htmlsb),$GatewayDefaultURL,$htmlwhite))
                                $rowdata += @(,("Web cookie",($Script:htmlsb),$GWWebCookie,$htmlwhite))                                   $rowdata += @(,("Web cookie",($Script:htmlsb),$GatewayWebCookie,$htmlwhite))
 
        $PAs = Get-RASPA -Siteid $Site.Id -EA 0 4> $Null <>         $PAs = Get-RASBroker -Siteid $Site.Id -EA 0 4> $Null
 
                Unable to retrieve Publishing Agents for Site $($Site.Name)` <>                 Unable to retrieve Connection Brokers for Site $($Site.Name)`
 
                        WriteWordLine 0 0 "Unable to retrieve Publishing Agents for Site $($Site.Name)" <>                         WriteWordLine 0 0 "Unable to retrieve Connection Brokers for Site $($Site.Name)"
 
                        Line 0 "Unable to retrieve Publishing Agents for Site $($Site.Name)" <>                         Line 0 "Unable to retrieve Connection Brokers for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "Unable to retrieve Publishing Agents for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "Unable to retrieve Connection Brokers for Site $($Site.Name)"
 
                No Publishing Agents retrieved for Site $($Site.Name).` <>                 No Connection Brokers retrieved for Site $($Site.Name).`
 
                        WriteWordLine 0 0 "No Publishing Agents retrieved for Site $($Site.Name)" <>                         WriteWordLine 0 0 "No Connection Brokers retrieved for Site $($Site.Name)"
 
                        Line 0 "No Publishing Agents retrieved for Site $($Site.Name)" <>                         Line 0 "No Connection Brokers retrieved for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "No Publishing Agents retrieved for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "No Connection Brokers retrieved for Site $($Site.Name)"
 
                        WriteWordLine 2 0 "Publishing Agents" <>                         WriteWordLine 2 0 "Connection Brokers"
 
                        Line 1 "Publishing Agents" <>                         Line 1 "Connection Brokers"
 
                        WriteHTMLLine 2 0 "Publishing Agents" <>                         WriteHTMLLine 2 0 "Connection Brokers"
 
                Write-Verbose "$(Get-Date -Format G): `t`tOutput Publishing Agents" <>                 Write-Verbose "$(Get-Date -Format G): `t`tOutput Connection Brokers"
 
                        $PAStatus = Get-RASPAStatus -Id $PA.Id -EA 0 4>$Null <>                         $PAStatus = Get-RASBrokerStatus -Id $PA.Id -EA 0 4>$Null
 
                                        WriteWordLine 3 0 "Publishing Agents $($PA.Server)" <>                                         WriteWordLine 3 0 "Connection Brokers $($PA.Server)"
 
                                        Line 2 "Publishing Agents $($PA.Server)" <>                                         Line 2 "Connection Brokers $($PA.Server)"
 
                                        WriteHTMLLine 3 0 "Publishing Agents $($PA.Server)" <>                                         WriteHTMLLine 3 0 "Connection Brokers $($PA.Server)"
 
        If([version]$Script:RASVersion -ge [version]"18.3") <>  
        {    
                $HALBs = Get-RASHALB -Siteid $Site.Id -EA 0 4> $Null            $HALBs = Get-RASHALB -Siteid $Site.Id -EA 0 4> $Null 
 
                If(!$?) <>         If(!$?)
                {           {
                        Write-Warning "                   Write-Warning "
                        `n                   `n
                        Unable to retrieve HALBs for Site $($Site.Name)`                   Unable to retrieve HALBs for Site $($Site.Name)`
                        "                   "
                        If($MSWord -or $PDF)                   If($MSWord -or $PDF)
                        {                   {
                                WriteWordLine 0 0 "Unable to retrieve HALBs for Site $($Site.Name)"                           WriteWordLine 0 0 "Unable to retrieve HALBs for Site $($Site.Name)"
                        }                   }
                        If($Text)                   If($Text)
                        {                   {
                                Line 0 "Unable to retrieve HALBs for Site $($Site.Name)"                           Line 0 "Unable to retrieve HALBs for Site $($Site.Name)"
                        }                   }
                        If($HTML)                   If($HTML)
                        {                   {
                                WriteHTMLLine 0 0 "Unable to retrieve HALBs for Site $($Site.Name)"                           WriteHTMLLine 0 0 "Unable to retrieve HALBs for Site $($Site.Name)"
                        }                   }
                }           }
                ElseIf($? -and $Null -eq $HALBs)           ElseIf($? -and $Null -eq $HALBs)
                {           {
                        Write-Host "                   Write-Host "
                        No HALBs retrieved for Site $($Site.Name).`           No HALBs retrieved for Site $($Site.Name).`
                        " -ForegroundColor White                   " -ForegroundColor White
                        If($MSWord -or $PDF)                   If($MSWord -or $PDF)
                        {                   {
                                WriteWordLine 0 0 "No HALBs retrieved for Site $($Site.Name)"                           WriteWordLine 0 0 "No HALBs retrieved for Site $($Site.Name)"
                        }                   }
                        If($Text)                   If($Text)
                        {                   {
                                Line 0 "No HALBs retrieved for Site $($Site.Name)"                           Line 0 "No HALBs retrieved for Site $($Site.Name)"
                            Line 0 ""
                        }                   }
                        If($HTML)                   If($HTML)
                        {                   {
                                WriteHTMLLine 0 0 "No HALBs retrieved for Site $($Site.Name)"                           WriteHTMLLine 0 0 "No HALBs retrieved for Site $($Site.Name)"
                        }                   }
                }           }
                Else           Else
                {           {
                        If($MSWord -or $PDF)                   If($MSWord -or $PDF)
                        {                   {
                                WriteWordLine 2 0 "HALB"                           WriteWordLine 2 0 "HALB"
                        }                   }
                        If($Text)                   If($Text)
                        {                   {
                                Line 1 "HALB"                           Line 1 "HALB"
                        }                   }
                        If($HTML)                   If($HTML)
                        {                   {
                                WriteHTMLLine 2 0 "HALB"                           WriteHTMLLine 2 0 "HALB"
                        }                   }
 
                        Write-Verbose "$(Get-Date -Format G): `t`tOutput HALB" <>                 Write-Verbose "$(Get-Date -Format G): `t`tOutput HALB"
                        ForEach($HALB in $HALBs)                   ForEach($HALB in $HALBs)
                        {                   {
                                $HALBStatusResult = Get-RASHALBStatus -Name $HALB.Name -EA 0 4> $Null                            $HALBStatusResult = Get-RASHALBStatus -Name $HALB.Name -EA 0 4> $Null 
                                                          
                                If($? -and $Null -ne $HALBStatusResult)                           If($? -and $Null -ne $HALBStatusResult)
                                {                           {
                                        $HALBStatus = GetRASStatus $HALBStatusResult.AgentState                                   $HALBStatus = GetRASStatus $HALBStatusResult.AgentState
                                }                           }
                                Else                           Else
                                {                           {
                                        $HALBStatus = "Unable to determine HALB status"                                   $HALBStatus = "Unable to determine HALB status"
                                }                           }
                                                          
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        WriteWordLine 3 0 "HALB $($HALB.Name)"                                   WriteWordLine 3 0 "HALB $($HALB.Name)"
                                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                                        $ScriptInformation.Add(@{Data = "Name"; Value = $HALB.Name; }) > $Null                                   $ScriptInformation.Add(@{Data = "Name"; Value = $HALB.Name; }) > $Null
                                        $ScriptInformation.Add(@{Data = "IPv4"; Value = $HALB.VirtualIPV4; }) > $Null                                   $ScriptInformation.Add(@{Data = "IPv4"; Value = $HALB.VirtualIPV4; }) > $Null
                                        $ScriptInformation.Add(@{Data = "IPv6"; Value = $HALB.VirtualIPV6; }) > $Null                                   $ScriptInformation.Add(@{Data = "IPv6"; Value = $HALB.VirtualIPV6; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Status"; Value = $HALBStatus; }) > $Null                                   $ScriptInformation.Add(@{Data = "Status"; Value = $HALBStatus; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Description"; Value = $HALB.Description; }) > $Null                                   $ScriptInformation.Add(@{Data = "Description"; Value = $HALB.Description; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Public Address"; Value = $HALB.PublicAddress; }) > $Null                                   $ScriptInformation.Add(@{Data = "Public Address"; Value = $HALB.PublicAddress; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Last modification by"; Value = $HALB.AdminLastMod; }) > $Null                                   $ScriptInformation.Add(@{Data = "Last modification by"; Value = $HALB.AdminLastMod; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Modified on"; Value = $HALB.TimeLastMod.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Modified on"; Value = $HALB.TimeLastMod.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Created by"; Value = $HALB.AdminCreate; }) > $Null                                   $ScriptInformation.Add(@{Data = "Created by"; Value = $HALB.AdminCreate; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Created on"; Value = $HALB.TimeCreate.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Created on"; Value = $HALB.TimeCreate.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "ID"; Value = $HALB.Id.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "ID"; Value = $HALB.Id.ToString(); }) > $Null
 
                                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                                        -Columns Data,Value `                                   -Columns Data,Value `
                                        -List `                                   -List `
                                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                        $Table.Columns.Item(1).Width = 200; <>                                 $Table.Columns.Item(1).Width = 200;
                                        $Table.Columns.Item(2).Width = 250;                                   $Table.Columns.Item(2).Width = 250;
 
                                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                                        $Table = $Null                                   $Table = $Null
                                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 2 "HALB $($HALB.Name)"                                   Line 2 "HALB $($HALB.Name)"
                                        Line 3 "Name`t`t`t: " $HALB.Name                                   Line 3 "Name`t`t`t: " $HALB.Name
                                        Line 3 "IPv4`t`t`t: " $HALB.VirtualIPV4                                   Line 3 "IPv4`t`t`t: " $HALB.VirtualIPV4
                                        Line 3 "IPv6`t`t`t: " $HALB.VirtualIPV6                                   Line 3 "IPv6`t`t`t: " $HALB.VirtualIPV6
                                        Line 3 "Status`t`t`t: " $HALBStatus                                   Line 3 "Status`t`t`t: " $HALBStatus
                                        Line 3 "Description`t`t: " $HALB.Description                                   Line 3 "Description`t`t: " $HALB.Description
                                        Line 3 "Public Address`t`t: " $HALB.PublicAddress                                   Line 3 "Public Address`t`t: " $HALB.PublicAddress
                                        Line 3 "Last modification by`t: " $HALB.AdminLastMod                                   Line 3 "Last modification by`t: " $HALB.AdminLastMod
                                        Line 3 "Modified on`t`t: " $HALB.TimeLastMod.ToString()                                   Line 3 "Modified on`t`t: " $HALB.TimeLastMod.ToString()
                                        Line 3 "Created by`t`t: " $HALB.AdminCreate                                   Line 3 "Created by`t`t: " $HALB.AdminCreate
                                        Line 3 "Created on`t`t: " $HALB.TimeCreate.ToString()                                   Line 3 "Created on`t`t: " $HALB.TimeCreate.ToString()
                                        Line 3 "ID`t`t`t: " $HALB.Id.ToString()                                   Line 3 "ID`t`t`t: " $HALB.Id.ToString()
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        WriteHTMLLine 3 0 "HALB $($HALB.Name)"                                   WriteHTMLLine 3 0 "HALB $($HALB.Name)"
                                        $rowdata = @()                                   $rowdata = @()
                                        $columnHeaders = @("Name",($Script:htmlsb),$HALB.Name,$htmlwhite)                                   $columnHeaders = @("Name",($Script:htmlsb),$HALB.Name,$htmlwhite)
                                        $rowdata += @(,("IPv4",($Script:htmlsb),$HALB.VirtualIPV4,$htmlwhite))                                   $rowdata += @(,("IPv4",($Script:htmlsb),$HALB.VirtualIPV4,$htmlwhite))
                                        $rowdata += @(,("IPv6",($Script:htmlsb),$HALB.VirtualIPV6,$htmlwhite))                                   $rowdata += @(,("IPv6",($Script:htmlsb),$HALB.VirtualIPV6,$htmlwhite))
                                        $rowdata += @(,("Status",($Script:htmlsb),$HALBStatus,$htmlwhite))                                   $rowdata += @(,("Status",($Script:htmlsb),$HALBStatus,$htmlwhite))
                                        $rowdata += @(,("Description",($Script:htmlsb),$HALB.Description,$htmlwhite))                                   $rowdata += @(,("Description",($Script:htmlsb),$HALB.Description,$htmlwhite))
                                        $rowdata += @(,("Public Address",($Script:htmlsb),$HALB.PublicAddress,$htmlwhite))                                   $rowdata += @(,("Public Address",($Script:htmlsb),$HALB.PublicAddress,$htmlwhite))
                                        $rowdata += @(,("Last modification by",($Script:htmlsb), $HALB.AdminLastMod,$htmlwhite))                                   $rowdata += @(,("Last modification by",($Script:htmlsb), $HALB.AdminLastMod,$htmlwhite))
                                        $rowdata += @(,("Modified on",($Script:htmlsb), $HALB.TimeLastMod.ToString(),$htmlwhite))                                   $rowdata += @(,("Modified on",($Script:htmlsb), $HALB.TimeLastMod.ToString(),$htmlwhite))
                                        $rowdata += @(,("Created by",($Script:htmlsb), $HALB.AdminCreate,$htmlwhite))                                   $rowdata += @(,("Created by",($Script:htmlsb), $HALB.AdminCreate,$htmlwhite))
                                        $rowdata += @(,("Created on",($Script:htmlsb), $HALB.TimeCreate.ToString(),$htmlwhite))                                   $rowdata += @(,("Created on",($Script:htmlsb), $HALB.TimeCreate.ToString(),$htmlwhite))
                                        $rowdata += @(,("ID",($Script:htmlsb),$HALB.Id.ToString(),$htmlwhite))                                   $rowdata += @(,("ID",($Script:htmlsb),$HALB.Id.ToString(),$htmlwhite))
 
                                        $msg = "" <>                                 $msg = ""
                                        $columnWidths = @("200","275")                                   $columnWidths = @("200","275")
                                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
 
                                If($MSWord -or $PDF) <>                         If($MSWord -or $PDF)
                                {                           {
                                        WriteWordLine 4 0 "General"                                   WriteWordLine 4 0 "General"
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 2 "General"                                   Line 2 "General"
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        #Nothing                                   #Nothing
                                }                           }
                                                          
                                Switch($HALB.IPVersion)                           Switch($HALB.IPVersion)
                                {                           {
                                        "Version4"              {$HALBIPVersion = "Version 4"; Break}                                   "Version4"              {$HALBIPVersion = "Version 4"; Break}
                                        "Version6"              {$HALBIPVersion = "Version 6"; Break}                                   "Version6"              {$HALBIPVersion = "Version 6"; Break}
                                        "BothVersions"  {$HALBIPVersion = "Both version 4 & 6"; Break}                                   "BothVersions"  {$HALBIPVersion = "Both version 4 & 6"; Break}
                                        Default                 {$HALBIPVersion = "Unable to determine IP version: $($HALB.IPVersion)"; Break}                                   Default                 {$HALBIPVersion = "Unable to determine IP version: $($HALB.IPVersion)"; Break}
                                }                           }
                                                          
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                                        $ScriptInformation.Add(@{Data = "Enable HALB"; Value = $HALB.EnableHALBInstance.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable HALB"; Value = $HALB.EnableHALBInstance.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Name"; Value = $HALB.Name; }) > $Null                                   $ScriptInformation.Add(@{Data = "Name"; Value = $HALB.Name; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Description"; Value = $HALB.Description; }) > $Null                                   $ScriptInformation.Add(@{Data = "Description"; Value = $HALB.Description; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Public address"; Value = $HALB.PublicAddress; }) > $Null                                   $ScriptInformation.Add(@{Data = "Public address"; Value = $HALB.PublicAddress; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Virtual IP"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "Virtual IP"; Value = ""; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     Use IP version"; Value = $HALBIPVersion; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Use IP version"; Value = $HALBIPVersion; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     IPv4"; Value = $HALB.VirtualIPV4; }) > $Null                                   $ScriptInformation.Add(@{Data = "     IPv4"; Value = $HALB.VirtualIPV4; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     Subnet Mask"; Value = $HALB.SubNetMask; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Subnet Mask"; Value = $HALB.SubNetMask; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     IPv6"; Value = $HALB.VirtualIPV6; }) > $Null                                   $ScriptInformation.Add(@{Data = "     IPv6"; Value = $HALB.VirtualIPV6; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     Prefix"; Value = $HALB.PrefixIPV6; }) > $Null                                   $ScriptInformation.Add(@{Data = "     Prefix"; Value = $HALB.PrefixIPV6; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Settings"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "Settings"; Value = ""; }) > $Null
                                        $ScriptInformation.Add(@{Data = "     LB Gateway Payload"; Value = $HALB.EnableGWPayload.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "     LB Gateway Payload"; Value = $HALB.EnableGWPayload.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "     LB SSL Payload"; Value = $HALB.EnableSSLPayload.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "     LB SSL Payload"; Value = $HALB.EnableSSLPayload.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "     Device Management"; Value = $HALB.EnableDeviceManagement.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "     Device Management"; Value = $HALB.EnableDeviceManagement.ToString(); }) > $Null
 
                                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                                        -Columns Data,Value `                                   -Columns Data,Value `
                                        -List `                                   -List `
                                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                        $Table.Columns.Item(1).Width = 200; <>                                 $Table.Columns.Item(1).Width = 200;
                                        $Table.Columns.Item(2).Width = 250;                                   $Table.Columns.Item(2).Width = 250;
 
                                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                                        $Table = $Null                                   $Table = $Null
                                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 3 "Enable HALB`t`t`t: " $HALB.EnableHALBInstance.ToString()                                   Line 3 "Enable HALB`t`t`t: " $HALB.EnableHALBInstance.ToString()
                                        Line 3 "Name`t`t`t`t: " $HALB.Name                                   Line 3 "Name`t`t`t`t: " $HALB.Name
                                        Line 3 "Description`t`t`t: " $HALB.Description                                   Line 3 "Description`t`t`t: " $HALB.Description
                                        Line 3 "Public address`t`t`t: " $HALB.PublicAddress                                   Line 3 "Public address`t`t`t: " $HALB.PublicAddress
                                        Line 3 "Virtual IP"                                   Line 3 "Virtual IP"
                                        Line 4 "Use IP version`t`t: " $HALBIPVersion                                   Line 4 "Use IP version`t`t: " $HALBIPVersion
                                        Line 4 "IPv4`t`t`t: " $HALB.VirtualIPV4                                   Line 4 "IPv4`t`t`t: " $HALB.VirtualIPV4
                                        Line 4 "Subnet Mask`t`t: " $HALB.SubNetMask                                   Line 4 "Subnet Mask`t`t: " $HALB.SubNetMask
                                        Line 4 "IPv6`t`t`t: " $HALB.VirtualIPV6                                   Line 4 "IPv6`t`t`t: " $HALB.VirtualIPV6
                                        Line 4 "Prefix`t`t`t: " $HALB.PrefixIPV6                                   Line 4 "Prefix`t`t`t: " $HALB.PrefixIPV6
                                        Line 3 "Settings"                                   Line 3 "Settings"
                                        Line 4 "LB Gateway Payload`t: " $HALB.EnableGWPayload.ToString()                                   Line 4 "LB Gateway Payload`t: " $HALB.EnableGWPayload.ToString()
                                        Line 4 "LB SSL Payload`t`t: " $HALB.EnableSSLPayload.ToString()                                   Line 4 "LB SSL Payload`t`t: " $HALB.EnableSSLPayload.ToString()
                                        Line 4 "Device Management`t: " $HALB.EnableDeviceManagement.ToString()                                   Line 4 "Device Management`t: " $HALB.EnableDeviceManagement.ToString()
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $rowdata = @()                                   $rowdata = @()
                                        $columnHeaders = @("Enable HALB",($Script:htmlsb),$HALB.EnableHALBInstance.ToString(),$htmlwhite)                                   $columnHeaders = @("Enable HALB",($Script:htmlsb),$HALB.EnableHALBInstance.ToString(),$htmlwhite)
                                        $rowdata += @(,("Name",($Script:htmlsb),$HALB.Name,$htmlwhite))                                   $rowdata += @(,("Name",($Script:htmlsb),$HALB.Name,$htmlwhite))
                                        $rowdata += @(,("Description",($Script:htmlsb),$HALB.Description,$htmlwhite))                                   $rowdata += @(,("Description",($Script:htmlsb),$HALB.Description,$htmlwhite))
                                        $rowdata += @(,("Public address",($Script:htmlsb),$HALB.PublicAddress,$htmlwhite))                                   $rowdata += @(,("Public address",($Script:htmlsb),$HALB.PublicAddress,$htmlwhite))
                                        $rowdata += @(,("Virtual IP",($Script:htmlsb), "",$htmlwhite))                                   $rowdata += @(,("Virtual IP",($Script:htmlsb), "",$htmlwhite))
                                        $rowdata += @(,("     Use IP version",($Script:htmlsb), $HALBIPVersion,$htmlwhite))                                   $rowdata += @(,("     Use IP version",($Script:htmlsb), $HALBIPVersion,$htmlwhite))
                                        $rowdata += @(,("     IPv4",($Script:htmlsb), $HALB.VirtualIPV4,$htmlwhite))                                   $rowdata += @(,("     IPv4",($Script:htmlsb), $HALB.VirtualIPV4,$htmlwhite))
                                        $rowdata += @(,("     Subnet Mask",($Script:htmlsb), $HALB.SubNetMask,$htmlwhite))                                   $rowdata += @(,("     Subnet Mask",($Script:htmlsb), $HALB.SubNetMask,$htmlwhite))
                                        $rowdata += @(,("     IPv6",($Script:htmlsb), $HALB.VirtualIPV6,$htmlwhite))                                   $rowdata += @(,("     IPv6",($Script:htmlsb), $HALB.VirtualIPV6,$htmlwhite))
                                        $rowdata += @(,("     Prefix",($Script:htmlsb), $HALB.PrefixIPV6,$htmlwhite))                                   $rowdata += @(,("     Prefix",($Script:htmlsb), $HALB.PrefixIPV6,$htmlwhite))
                                        $rowdata += @(,("Settings",($Script:htmlsb), "",$htmlwhite))                                   $rowdata += @(,("Settings",($Script:htmlsb), "",$htmlwhite))
                                        $rowdata += @(,("     LB Gateway Payload",($Script:htmlsb), $HALB.EnableGWPayload.ToString(),$htmlwhite))                                   $rowdata += @(,("     LB Gateway Payload",($Script:htmlsb), $HALB.EnableGWPayload.ToString(),$htmlwhite))
                                        $rowdata += @(,("     LB SSL Payload",($Script:htmlsb), $HALB.EnableSSLPayload.ToString(),$htmlwhite))                                   $rowdata += @(,("     LB SSL Payload",($Script:htmlsb), $HALB.EnableSSLPayload.ToString(),$htmlwhite))
                                        $rowdata += @(,("     Device Management",($Script:htmlsb), $HALB.EnableDeviceManagement.ToString(),$htmlwhite))                                   $rowdata += @(,("     Device Management",($Script:htmlsb), $HALB.EnableDeviceManagement.ToString(),$htmlwhite))
 
                                        $msg = "General" <>                                 $msg = "General"
                                        $columnWidths = @("200","400")                                   $columnWidths = @("200","400")
                                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
 
                                If($MSWord -or $PDF) <>                         If($MSWord -or $PDF)
                                {                           {
                                        WriteWordLine 4 0 "LB gateway payload"                                   WriteWordLine 4 0 "LB gateway payload"
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 2 "LB gateway payload"                                   Line 2 "LB gateway payload"
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        WriteHTMLLine 4 0 "LB gateway payload"                                   WriteHTMLLine 4 0 "LB gateway payload"
                                }                           }
                                                          
                                $HALBGatewayPort = $HALB.GatewayConfig.Port.ToString()                           $HALBGatewayPort = $HALB.GatewayConfig.Port.ToString()
                                $HALBGateways    = $HALB.GatewayConfig.Gateways                           $HALBGateways    = $HALB.GatewayConfig.Gateways
                                                          
                                #First, get the port                           #First, get the port
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                                        $ScriptInformation.Add(@{Data = "Port"; Value = $HALBGatewayPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "Port"; Value = $HALBGatewayPort; }) > $Null
 
                                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                                        -Columns Data,Value `                                   -Columns Data,Value `
                                        -List `                                   -List `
                                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                        $Table.Columns.Item(1).Width = 200; <>                                 $Table.Columns.Item(1).Width = 200;
                                        $Table.Columns.Item(2).Width = 250;                                   $Table.Columns.Item(2).Width = 250;
 
                                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                                        $Table = $Null                                   $Table = $Null
                                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 3 "Port: " $HALBGatewayPort                                   Line 3 "Port: " $HALBGatewayPort
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $rowdata = @()                                   $rowdata = @()
                                        $columnHeaders = @("Port",($Script:htmlsb),$HALBGatewayPort,$htmlwhite)                                   $columnHeaders = @("Port",($Script:htmlsb),$HALBGatewayPort,$htmlwhite)
                                        #$rowdata += @(,("",($Script:htmlsb),"",$htmlwhite))                                   #$rowdata += @(,("",($Script:htmlsb),"",$htmlwhite))
 
                                        $msg = "" <>                                 $msg = ""
                                        $columnWidths = @("200","400")                                   $columnWidths = @("200","400")
                                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
 
                                #second, process the gateways <>                         #second, process the gateways
                                #do output headers                           #do output headers
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        [System.Collections.Hashtable[]] $GatewaysWordTable = @();                                   [System.Collections.Hashtable[]] $GatewaysWordTable = @();
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 3 "Gateways                                                 Status                                  "                                   Line 3 "Gateways                                                 Status                                  "
                                        Line 3 "================================================================================================="                                   Line 3 "================================================================================================="
                                        #       abcdefghijklmno.abcdefghijklmno.local (999.999.999.999)SS1234567890123456789012345678901234567890                                   #       abcdefghijklmno.abcdefghijklmno.local (999.999.999.999)SS1234567890123456789012345678901234567890
                                        #       1234567890123456789012345678901234567890123456789012345                                   #       1234567890123456789012345678901234567890123456789012345
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $rowdata = @()                                   $rowdata = @()
                                }                           }
                                                          
                                #process the gateways data                           #process the gateways data
                                ForEach($GWItem in $HALBGateways)                           ForEach($GatewayItem in $HALBGateways)
                                {                           {
                                        $ip = $GWItem.Keys                                   $ip = $GatewayItem.Keys
                                        $Results = [System.Net.Dns]::gethostentry($ip)                                   $Results = [System.Net.Dns]::gethostentry($ip)
                                        $hostname = $Results.HostName                                   $hostname = $Results.HostName
                                        $TempGW = Get-RASGWStatus -Server $hostname -EA 0 4> $Null                                   $TempGW = Get-RASGatewayStatus -Server $hostname -EA 0 4> $Null
                                        $HALBGWStatus = GetRASStatus $TempGW.AgentState                                   $HALBGWStatus = GetRASStatus $TempGW.AgentState
                                                                          
                                        If($MSWord -or $PDF)                                   If($MSWord -or $PDF)
                                        {                                   {
                                                $GatewaysWordTableRowHash = @{                                           $GatewaysWordTableRowHash = @{
                                                        Gateway       = "$hostname ($ip)";                                                   Gateway       = "$hostname ($ip)";
                                                        GatewayStatus = $HALBGWStatus;                                                   GatewayStatus = $HALBGWStatus;
                                                }                                           }
                                                $GatewaysWordTable += $GatewaysWordTableRowHash                                           $GatewaysWordTable += $GatewaysWordTableRowHash
                                        }                                   }
                                        If($Text)                                   If($Text)
                                        {                                   {
                                                Line 3 ( "{0,-55}  {1,-40}" -f "$hostname ($ip)", $HALBGWStatus)                                           Line 3 ( "{0,-55}  {1,-40}" -f "$hostname ($ip)", $HALBGWStatus)
                                        }                                   }
                                        If($HTML)                                   If($HTML)
                                        {                                   {
                                                $rowdata += @(,(                                           $rowdata += @(,(
                                                "$hostname ($ip)",$htmlwhite,                                           "$hostname ($ip)",$htmlwhite,
                                                $HALBGWStatus,$htmlwhite))                                           $HALBGWStatus,$htmlwhite))
                                        }                                   }
                                }                           }
                                                          
                                #output the Word/PDF and HTML tables                           #output the Word/PDF and HTML tables
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        If($GatewaysWordTable.Count -gt 0)                                   If($GatewaysWordTable.Count -gt 0)
                                        {                                   {
                                                $Table = AddWordTable -Hashtable $GatewaysWordTable `                                           $Table = AddWordTable -Hashtable $GatewaysWordTable `
                                                -Columns  Gateway,GatewayStatus `                                           -Columns  Gateway,GatewayStatus `
                                                -Headers  "Gateways","Status"`                                           -Headers  "Gateways","Status"`
                                                -Format $wdTableGrid `                                           -Format $wdTableGrid `
                                                -AutoFit $wdAutoFitFixed;                                           -AutoFit $wdAutoFitFixed;
 
                                                SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15; <>                                         SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                                $Table.Columns.Item(1).Width = 200; <>                                         $Table.Columns.Item(1).Width = 200;
                                                $Table.Columns.Item(2).Width = 250;                                           $Table.Columns.Item(2).Width = 250;
 
                                                $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                         $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                                FindWordDocumentEnd <>                                         FindWordDocumentEnd
                                                $Table = $Null                                           $Table = $Null
                                                WriteWordLine 0 0 ""                                           WriteWordLine 0 0 ""
                                        }                                   }
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $columnHeaders = @(                                   $columnHeaders = @(
                                        "Gateways",($Script:htmlsb),                                   "Gateways",($Script:htmlsb),
                                        "Status",($Script:htmlsb))                                   "Status",($Script:htmlsb))
 
                                        $msg = "" <>                                 $msg = ""
                                        $columnWidths = @("200","400")                                   $columnWidths = @("200","400")
                                        FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "600"                                   FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "600"
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
                                                          
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        WriteWordLine 4 0 "LB SSL payload"                                   WriteWordLine 4 0 "LB SSL payload"
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 2 "LB SSL payload"                                   Line 2 "LB SSL payload"
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        #Nothing                                   #Nothing
                                }                           }
                                                          
                                $HALBSSLGatewayPort = $HALB.SSLConfig.GatewayConfig.Port.ToString()                           $HALBSSLGatewayPort = $HALB.SSLConfig.GatewayConfig.Port.ToString()
                                $HALBSSLGateways    = $HALB.SSLConfig.GatewayConfig.Gateways                           $HALBSSLGateways    = $HALB.SSLConfig.GatewayConfig.Gateways
                                                          
                                Switch($HALB.SSLConfig.SSLMode)                           Switch($HALB.SSLConfig.SSLMode)
                                {                           {
                                        "SSLOffloading"         {$HALBSSLMode = "SSL Offloading"; Break}                                   "SSLOffloading"         {$HALBSSLMode = "SSL Offloading"; Break}
                                        "SSLPassthrough"        {$HALBSSLMode = "Passthrough"; Break}                                   "SSLPassthrough"        {$HALBSSLMode = "Passthrough"; Break}
                                        Default                         {$HALBSSLMode = "Unable to etermine SSL Mode: $($HALB.SSLConfig.SSLMode)"; Break}                                   Default                         {$HALBSSLMode = "Unable to etermine SSL Mode: $($HALB.SSLConfig.SSLMode)"; Break}
                                }                           }
                                                          
                                If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")                           If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")
                                {                           {
                                        Switch($HALB.SSLConfig.MinSSLVersion)                                   Switch($HALB.SSLConfig.MinSSLVersion)
                                        {                                   {
                                                "SSLv2"         {$HALBSSLAcceptedSSLVersions = "SSL v2 - TLS v1.2 (Weak)"; Break}                                           "SSLv2"         {$HALBSSLAcceptedSSLVersions = "SSL v2 - TLS v1.2 (Weak)"; Break}
                                                "SSLv3"         {$HALBSSLAcceptedSSLVersions = "SSL v3 - TLS v1.2"; Break}                                           "SSLv3"         {$HALBSSLAcceptedSSLVersions = "SSL v3 - TLS v1.2"; Break}
                                                "TLSv1"         {$HALBSSLAcceptedSSLVersions = "TLS v1.0 - TLS v1.2"; Break}                                           "TLSv1"         {$HALBSSLAcceptedSSLVersions = "TLS v1.0 - TLS v1.2"; Break}
                                                "TLSv1_1"       {$HALBSSLAcceptedSSLVersions = "TLS v1.1 - TLS v1.2"; Break}                                           "TLSv1_1"       {$HALBSSLAcceptedSSLVersions = "TLS v1.1 - TLS v1.2"; Break}
                                                "TLSv1_2"       {$HALBSSLAcceptedSSLVersions = "TLS v1.2 only (Strong)"; Break}                                           "TLSv1_2"       {$HALBSSLAcceptedSSLVersions = "TLS v1.2 only (Strong)"; Break}
                                                Default         {$HALBSSLAcceptedSSLVersions = "Unable to determine Minimum SSL version: $($HALB.SSLConfig.MinSSLVersion)"; Break}                                           Default         {$HALBSSLAcceptedSSLVersions = "Unable to determine Minimum SSL version: $($HALB.SSLConfig.MinSSLVersion)"; Break}
                                        }                                   }
                                                                          
                                        If($HALB.SSLConfig.SSLCipherStrength -eq "Custom")                                   If($HALB.SSLConfig.SSLCipherStrength -eq "Custom")
                                        {                                   {
                                                $HALBSSLCipherStrength = "Custom"                                           $HALBSSLCipherStrength = "Custom"
                                                $HALBSSLCipher         = $HALB.SSLConfig.SSLCustomCipher                                           $HALBSSLCipher         = $HALB.SSLConfig.SSLCustomCipher
                                        }                                   }
                                        Else                                   Else
                                        {                                   {
                                                $HALBSSLCipherStrength = $HALB.SSLConfig.SSLCipherStrength                                           $HALBSSLCipherStrength = $HALB.SSLConfig.SSLCipherStrength
                                                Switch($HALB.SSLConfig.SSLCipherStrength)                                           Switch($HALB.SSLConfig.SSLCipherStrength)
                                                {                                           {
                                                        "Low"           {$HALBSSLCipher = "All:!aNULL:!eNULL"; Break}                                                   "Low"           {$HALBSSLCipher = "All:!aNULL:!eNULL"; Break}
                                                        "Medium"        {$HALBSSLCipher = "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"; Break}                                                   "Medium"        {$HALBSSLCipher = "ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM"; Break}
                                                        "High"          {$HALBSSLCipher = "EECDH:!SSLv2:!aNULL:!RC4:!ADH:!eNULL:!LOW:!MEDIUM:!EXP:+HIGH"; Break}                                                   "High"          {$HALBSSLCipher = "EECDH:!SSLv2:!aNULL:!RC4:!ADH:!eNULL:!LOW:!MEDIUM:!EXP:+HIGH"; Break}
                                                        Default         {$HALBSSLCipher = "Unable to determine SSL cipher strength: $($HALB.SSLConfig.SSLCipherStrength)"; Break}                                                   Default         {$HALBSSLCipher = "Unable to determine SSL cipher strength: $($HALB.SSLConfig.SSLCipherStrength)"; Break}
                                                }                                           }
                                        }                                   }
                                        $HALBSSLUseServerPreference = $HALB.SSLConfig.SSLCipherPreference.ToString()                                   $HALBSSLUseServerPreference = $HALB.SSLConfig.SSLCipherPreference.ToString()
                                        If($HALB.SSLConfig.CertID -eq 0)                                   If($HALB.SSLConfig.CertID -eq 0)
                                        {                                   {
                                                $HALBSSLCertificates = "All matching usage"                                           $HALBSSLCertificates = "All matching usage"
                                        }                                   }
                                        Else                                   Else
                                        {                                   {
                                                $Results = Get-RASCertificate -Id $HALB.SSLConfig.CertID -EA 0 4> $Null                                           $Results = Get-RASCertificate -Id $HALB.SSLConfig.CertID -EA 0 4> $Null
                                                                                          
                                                If($? -and $Null -ne $Results)                                           If($? -and $Null -ne $Results)
                                                {                                           {
                                                        $HALBSSLCertificates = $Results.Name                                                   $HALBSSLCertificates = $Results.Name
                                                }                                           }
                                                Else                                           Else
                                                {                                           {
                                                        $HALBSSLCertificates = "Unable to find certificate with an ID of $($HALB.SSLConfig.CertID)"                                                   $HALBSSLCertificates = "Unable to find certificate with an ID of $($HALB.SSLConfig.CertID)"
                                                }                                           }
                                        }                                   }
                                }                           }
                                Else                           Else
                                {                           {
                                        $HALBSSLAcceptedSSLVersions = ""                                   $HALBSSLAcceptedSSLVersions = ""
                                        $HALBSSLCipherStrength      = ""                                   $HALBSSLCipherStrength      = ""
                                        $HALBSSLCipher              = ""                                   $HALBSSLCipher              = ""
                                        $HALBSSLUseServerPreference = ""                                   $HALBSSLUseServerPreference = ""
                                        $HALBSSLCertificates        = ""                                   $HALBSSLCertificates        = ""
                                }                           }
                                                          
                                #First, get the port                           #First, get the port
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                                        $ScriptInformation.Add(@{Data = "Port"; Value = $HALBSSLGatewayPort; }) > $Null                                   $ScriptInformation.Add(@{Data = "Port"; Value = $HALBSSLGatewayPort; }) > $Null
                                        $ScriptInformation.Add(@{Data = "Mode"; Value = $HALBSSLMode; }) > $Null                                   $ScriptInformation.Add(@{Data = "Mode"; Value = $HALBSSLMode; }) > $Null
                                        If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")                                   If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")
                                        {                                   {
                                                $ScriptInformation.Add(@{Data = "Security"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "Security"; Value = ""; }) > $Null
                                                $ScriptInformation.Add(@{Data = "     Accepted SSL Versions"; Value = $HALBSSLAcceptedSSLVersions; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Accepted SSL Versions"; Value = $HALBSSLAcceptedSSLVersions; }) > $Null
                                                $ScriptInformation.Add(@{Data = "     Cipher Strength"; Value = $HALBSSLCipherStrength; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Cipher Strength"; Value = $HALBSSLCipherStrength; }) > $Null
                                                $ScriptInformation.Add(@{Data = "     Cipher"; Value = $HALBSSLCipher; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Cipher"; Value = $HALBSSLCipher; }) > $Null
                                                $ScriptInformation.Add(@{Data = "     Use ciphers according to server preference"; Value = $HALBSSLUseServerPreference; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Use ciphers according to server preference"; Value = $HALBSSLUseServerPreference; }) > $Null
                                                $ScriptInformation.Add(@{Data = "     Certificates"; Value = $HALBSSLCertificates; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Certificates"; Value = $HALBSSLCertificates; }) > $Null
                                        }                                   }
 
                                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                                        -Columns Data,Value `                                   -Columns Data,Value `
                                        -List `                                   -List `
                                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                        $Table.Columns.Item(1).Width = 200; <>                                 $Table.Columns.Item(1).Width = 200;
                                        $Table.Columns.Item(2).Width = 250;                                   $Table.Columns.Item(2).Width = 250;
 
                                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                                        $Table = $Null                                   $Table = $Null
                                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 3 "Port: " $HALBSSLGatewayPort                                   Line 3 "Port: " $HALBSSLGatewayPort
                                        Line 3 "Mode: " $HALBSSLMode                                   Line 3 "Mode: " $HALBSSLMode
                                        If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")                                   If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")
                                        {                                   {
                                                Line 3 "Security"                                           Line 3 "Security"
                                                Line 4 "Accepted SSL Versions`t`t`t`t: " $HALBSSLAcceptedSSLVersions                                           Line 4 "Accepted SSL Versions`t`t`t`t: " $HALBSSLAcceptedSSLVersions
                                                Line 4 "Cipher Strength`t`t`t`t`t: " $HALBSSLCipherStrength                                           Line 4 "Cipher Strength`t`t`t`t`t: " $HALBSSLCipherStrength
                                                Line 4 "Cipher`t`t`t`t`t`t: " $HALBSSLCipher                                           Line 4 "Cipher`t`t`t`t`t`t: " $HALBSSLCipher
                                                Line 4 "Use ciphers according to server preference`t: " $HALBSSLUseServerPreference                                           Line 4 "Use ciphers according to server preference`t: " $HALBSSLUseServerPreference
                                                Line 4 "Certificates`t`t`t`t`t: " $HALBSSLCertificates                                           Line 4 "Certificates`t`t`t`t`t: " $HALBSSLCertificates
                                        }                                   }
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $rowdata = @()                                   $rowdata = @()
                                        $columnHeaders = @("Port",($Script:htmlsb),$HALBSSLGatewayPort,$htmlwhite)                                   $columnHeaders = @("Port",($Script:htmlsb),$HALBSSLGatewayPort,$htmlwhite)
                                        $rowdata += @(,("Mode",($Script:htmlsb),$HALBSSLMode,$htmlwhite))                                   $rowdata += @(,("Mode",($Script:htmlsb),$HALBSSLMode,$htmlwhite))
                                        If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")                                   If($HALB.SSLConfig.SSLMode -eq "SSLOffloading")
                                        {                                   {
                                                $rowdata += @(,( "Security",($Script:htmlsb), "",$htmlwhite))                                           $rowdata += @(,( "Security",($Script:htmlsb), "",$htmlwhite))
                                                $rowdata += @(,( "     Accepted SSL Versions",($Script:htmlsb), $HALBSSLAcceptedSSLVersions,$htmlwhite))                                           $rowdata += @(,( "     Accepted SSL Versions",($Script:htmlsb), $HALBSSLAcceptedSSLVersions,$htmlwhite))
                                                $rowdata += @(,( "     Cipher Strength",($Script:htmlsb), $HALBSSLCipherStrength,$htmlwhite))                                           $rowdata += @(,( "     Cipher Strength",($Script:htmlsb), $HALBSSLCipherStrength,$htmlwhite))
                                                $rowdata += @(,( "     Cipher",($Script:htmlsb), $HALBSSLCipher,$htmlwhite))                                           $rowdata += @(,( "     Cipher",($Script:htmlsb), $HALBSSLCipher,$htmlwhite))
                                                $rowdata += @(,( "     Use ciphers according to server preference",($Script:htmlsb), $HALBSSLUseServerPreference,$htmlwhite))                                           $rowdata += @(,( "     Use ciphers according to server preference",($Script:htmlsb), $HALBSSLUseServerPreference,$htmlwhite))
                                                $rowdata += @(,( "     Certificates",($Script:htmlsb), $HALBSSLCertificates,$htmlwhite))                                           $rowdata += @(,( "     Certificates",($Script:htmlsb), $HALBSSLCertificates,$htmlwhite))
                                        }                                   }
 
                                        $msg = "" <>                                 $msg = ""
                                        $columnWidths = @("200","400")                                   $columnWidths = @("200","400")
                                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
 
                                #second, process the gateways <>                         #second, process the gateways
                                #do output headers                           #do output headers
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        [System.Collections.Hashtable[]] $GatewaysWordTable = @();                                   [System.Collections.Hashtable[]] $GatewaysWordTable = @();
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 3 "Gateways                                                 Status                                  "                                   Line 3 "Gateways                                                 Status                                  "
                                        Line 3 "================================================================================================="                                   Line 3 "================================================================================================="
                                        #       abcdefghijklmno.abcdefghijklmno.local (999.999.999.999)SS1234567890123456789012345678901234567890                                   #       abcdefghijklmno.abcdefghijklmno.local (999.999.999.999)SS1234567890123456789012345678901234567890
                                        #       1234567890123456789012345678901234567890123456789012345                                   #       1234567890123456789012345678901234567890123456789012345
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $rowdata = @()                                   $rowdata = @()
                                }                           }
                                                          
                                #process the gateways data                           #process the gateways data
                                ForEach($GWItem in $HALBSSLGateways)                           ForEach($GatewayItem in $HALBSSLGateways)
                                {                           {
                                        $ip = $GWItem.Keys                                   $ip = $GatewayItem.Keys
                                        $Results = [System.Net.Dns]::gethostentry($ip)                                   $Results = [System.Net.Dns]::gethostentry($ip)
                                        $hostname = $Results.HostName                                   $hostname = $Results.HostName
                                        $TempGW = Get-RASGWStatus -Server $hostname -EA 0 4> $Null                                   $TempGW = Get-RASGatewayStatus -Server $hostname -EA 0 4> $Null
                                        $HALBGWStatus = GetRASStatus $TempGW.AgentState                                   $HALBGWStatus = GetRASStatus $TempGW.AgentState
                                                                          
                                        If($MSWord -or $PDF)                                   If($MSWord -or $PDF)
                                        {                                   {
                                                $GatewaysWordTableRowHash = @{                                           $GatewaysWordTableRowHash = @{
                                                        Gateway       = "$hostname ($ip)";                                                   Gateway       = "$hostname ($ip)";
                                                        GatewayStatus = $HALBGWStatus;                                                   GatewayStatus = $HALBGWStatus;
                                                }                                           }
                                                $GatewaysWordTable += $GatewaysWordTableRowHash                                           $GatewaysWordTable += $GatewaysWordTableRowHash
                                        }                                   }
                                        If($Text)                                   If($Text)
                                        {                                   {
                                                Line 3 ( "{0,-55}  {1,-40}" -f "$hostname ($ip)", $HALBGWStatus)                                           Line 3 ( "{0,-55}  {1,-40}" -f "$hostname ($ip)", $HALBGWStatus)
                                        }                                   }
                                        If($HTML)                                   If($HTML)
                                        {                                   {
                                                $rowdata += @(,(                                           $rowdata += @(,(
                                                "$hostname ($ip)",$htmlwhite,                                           "$hostname ($ip)",$htmlwhite,
                                                $HALBGWStatus,$htmlwhite))                                           $HALBGWStatus,$htmlwhite))
                                        }                                   }
                                }                           }
                                                          
                                #output the Word/PDF and HTML tables                           #output the Word/PDF and HTML tables
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        If($GatewaysWordTable.Count -gt 0)                                   If($GatewaysWordTable.Count -gt 0)
                                        {                                   {
                                                $Table = AddWordTable -Hashtable $GatewaysWordTable `                                           $Table = AddWordTable -Hashtable $GatewaysWordTable `
                                                -Columns  Gateway,GatewayStatus `                                           -Columns  Gateway,GatewayStatus `
                                                -Headers  "Gateways","Status"`                                           -Headers  "Gateways","Status"`
                                                -Format $wdTableGrid `                                           -Format $wdTableGrid `
                                                -AutoFit $wdAutoFitFixed;                                           -AutoFit $wdAutoFitFixed;
 
                                                SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15; <>                                         SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                                $Table.Columns.Item(1).Width = 200; <>                                         $Table.Columns.Item(1).Width = 200;
                                                $Table.Columns.Item(2).Width = 250;                                           $Table.Columns.Item(2).Width = 250;
 
                                                $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                         $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                                FindWordDocumentEnd <>                                         FindWordDocumentEnd
                                                $Table = $Null                                           $Table = $Null
                                                WriteWordLine 0 0 ""                                           WriteWordLine 0 0 ""
                                        }                                   }
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $columnHeaders = @(                                   $columnHeaders = @(
                                        "Gateways",($Script:htmlsb),                                   "Gateways",($Script:htmlsb),
                                        "Status",($Script:htmlsb))                                   "Status",($Script:htmlsb))
 
                                        $msg = "" <>                                 $msg = ""
                                        $columnWidths = @("200","400")                                   $columnWidths = @("200","400")
                                        FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "600"                                   FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "600"
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
 
                                If($MSWord -or $PDF) <>                         If($MSWord -or $PDF)
                                {                           {
                                        WriteWordLine 4 0 "Device Manager"                                   WriteWordLine 4 0 "Device Manager"
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 2 "Device Manager"                                   Line 2 "Device Manager"
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        #Nothing                                   #Nothing
                                }                           }
                                                          
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                                        $ScriptInformation.Add(@{Data = "Port"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "Port"; Value = ""; }) > $Null
 
                                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                                        -Columns Data,Value `                                   -Columns Data,Value `
                                        -List `                                   -List `
                                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                        $Table.Columns.Item(1).Width = 200; <>                                 $Table.Columns.Item(1).Width = 200;
                                        $Table.Columns.Item(2).Width = 250;                                   $Table.Columns.Item(2).Width = 250;
 
                                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                                        $Table = $Null                                   $Table = $Null
                                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 3 "Port: "                                   Line 3 "Port: "
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $rowdata = @()                                   $rowdata = @()
                                        $columnHeaders = @("Port",($Script:htmlsb),"",$htmlwhite)                                   $columnHeaders = @("Port",($Script:htmlsb),"",$htmlwhite)
                                        $rowdata += @(,("",($Script:htmlsb),"",$htmlwhite))                                   $rowdata += @(,("",($Script:htmlsb),"",$htmlwhite))
 
                                        $msg = "Device Manager" <>                                 $msg = "Device Manager"
                                        $columnWidths = @("200","400")                                   $columnWidths = @("200","400")
                                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
 
                                If($MSWord -or $PDF) <>                         If($MSWord -or $PDF)
                                {                           {
                                        WriteWordLine 4 0 "Devices"                                   WriteWordLine 4 0 "Devices"
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 2 "Devices"                                   Line 2 "Devices"
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        #Nothing                                   #Nothing
                                }                           }
                                                          
                                $HALBDevices = Get-RASHALBDevice -HALBName $HALB.Name -EA 0 4> $Null                           $HALBDevices = Get-RASHALBDevice -HALBName $HALB.Name -EA 0 4> $Null
                                                          
                                If((!$?) -or ($? -and $Null -eq $HALBDevices))                           If((!$?) -or ($? -and $Null -eq $HALBDevices))
                                {                           {
                                        Write-Host "                                   Write-Host "
                                        No HALB Devices retrieved for HALB $($HALB.Name).`                                   No HALB Devices retrieved for HALB $($HALB.Name).`
                                        " -ForegroundColor White                                   " -ForegroundColor White
                                        If($MSWord -or $PDF)                                   If($MSWord -or $PDF)
                                        {                                   {
                                                WriteWordLine 0 0 "No HALB Devices retrieved for HALB $($HALB.Name)"                                           WriteWordLine 0 0 "No HALB Devices retrieved for HALB $($HALB.Name)"
                                        }                                   }
                                        If($Text)                                   If($Text)
                                        {                                   {
                                                Line 0 "No HALB Devices retrieved for HALB $($HALB.Name)"                                           Line 0 "No HALB Devices retrieved for HALB $($HALB.Name)"
                                        }                                   }
                                        If($HTML)                                   If($HTML)
                                        {                                   {
                                                WriteHTMLLine 0 0 "No HALB Devices retrieved for HALB $($HALB.Name)"                                           WriteHTMLLine 0 0 "No HALB Devices retrieved for HALB $($HALB.Name)"
                                        }                                   }
                                }                           }
                                Else                           Else
                                {                           {
                                        If($MSWord -or $PDF)                                   If($MSWord -or $PDF)
                                        {                                   {
                                                [System.Collections.Hashtable[]] $HALBDevicesWordTable = @();                                           [System.Collections.Hashtable[]] $HALBDevicesWordTable = @();
                                        }                                   }
                                        If($Text)                                   If($Text)
                                        {                                   {
                                                Line 3 "Devices          ID"                                           Line 3 "Devices          ID"
                                                Line 3 "==================="                                           Line 3 "==================="
                                                #       999.999.999.999SS12                                           #       999.999.999.999SS12
                                        }                                   }
                                        If($HTML)                                   If($HTML)
                                        {                                   {
                                                $rowdata = @()                                           $rowdata = @()
                                        }                                   }
                                                                          
                                        #process the gateways data                                   #process the gateways data
                                        ForEach($HALBDevice in $HALBDevices)                                   ForEach($HALBDevice in $HALBDevices)
                                        {                                   {
                                                $ip = $HALBDevice.DeviceIP                                           $ip = $HALBDevice.DeviceIP
                                                $ID = $HALBDevice.DeviceId                                           $ID = $HALBDevice.DeviceId
                                                                                          
                                                If($MSWord -or $PDF)                                           If($MSWord -or $PDF)
                                                {                                           {
                                                        $HALBDevicesWordTableRowHash = @{                                                   $HALBDevicesWordTableRowHash = @{
                                                                DeviceIP = $ip;                                                           DeviceIP = $ip;
                                                                DeviceID = $ID;                                                           DeviceID = $ID;
                                                        }                                                   }
                                                        $HALBDevicesWordTable += $HALBDevicesWordTableRowHash                                                   $HALBDevicesWordTable += $HALBDevicesWordTableRowHash
                                                }                                           }
                                                If($Text)                                           If($Text)
                                                {                                           {
                                                        Line 3 ( "{0,-15}  {1,-2}" -f $ip, $ID)                                                   Line 3 ( "{0,-15}  {1,-2}" -f $ip, $ID)
                                                }                                           }
                                                If($HTML)                                           If($HTML)
                                                {                                           {
                                                        $rowdata += @(,(                                                   $rowdata += @(,(
                                                        $ip,$htmlwhite,                                                   $ip,$htmlwhite,
                                                        $ID,$htmlwhite))                                                   $ID,$htmlwhite))
                                                }                                           }
                                        }                                   }
                                                                          
                                        #output the Word/PDF and HTML tables                                   #output the Word/PDF and HTML tables
                                        If($MSWord -or $PDF)                                   If($MSWord -or $PDF)
                                        {                                   {
                                                If($HALBDevicesWordTable.Count -gt 0)                                           If($HALBDevicesWordTable.Count -gt 0)
                                                {                                           {
                                                        $Table = AddWordTable -Hashtable $HALBDevicesWordTable `                                                   $Table = AddWordTable -Hashtable $HALBDevicesWordTable `
                                                        -Columns  DeviceIP,DeviceID `                                                   -Columns  DeviceIP,DeviceID `
                                                        -Headers  "Devices","ID" `                                                   -Headers  "Devices","ID" `
                                                        -Format $wdTableGrid `                                                   -Format $wdTableGrid `
                                                        -AutoFit $wdAutoFitFixed;                                                   -AutoFit $wdAutoFitFixed;
 
                                                        SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15; <>                                                 SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                                        $Table.Columns.Item(1).Width = 100; <>                                                 $Table.Columns.Item(1).Width = 100;
                                                        $Table.Columns.Item(2).Width = 50;                                                   $Table.Columns.Item(2).Width = 50;
 
                                                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                                        FindWordDocumentEnd <>                                                 FindWordDocumentEnd
                                                        $Table = $Null                                                   $Table = $Null
                                                        WriteWordLine 0 0 ""                                                   WriteWordLine 0 0 ""
                                                }                                           }
                                        }                                   }
                                        If($Text)                                   If($Text)
                                        {                                   {
                                                Line 0 ""                                           Line 0 ""
                                        }                                   }
                                        If($HTML)                                   If($HTML)
                                        {                                   {
                                                $columnHeaders = @(                                           $columnHeaders = @(
                                                "Devices",($Script:htmlsb),                                           "Devices",($Script:htmlsb),
                                                "ID",($Script:htmlsb))                                           "ID",($Script:htmlsb))
 
                                                $msg = "" <>                                         $msg = ""
                                                $columnWidths = @("100","50")                                           $columnWidths = @("100","50")
                                                FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "150"                                           FormatHTMLTable $msg -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths -tablewidth "150"
                                                WriteHTMLLine 0 0 ""                                           WriteHTMLLine 0 0 ""
                                        }                                   }
                                }                           }
 
                                If($MSWord -or $PDF) <>                         If($MSWord -or $PDF)
                                {                           {
                                        WriteWordLine 4 0 "Advanced"                                   WriteWordLine 4 0 "Advanced"
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 2 "Advanced"                                   Line 2 "Advanced"
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        #Nothing                                   #Nothing
                                }                           }
                                                          
                                If($MSWord -or $PDF)                           If($MSWord -or $PDF)
                                {                           {
                                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                                        $ScriptInformation.Add(@{Data = "Enable RDP UPD tunneling"; Value = $HALB.EnableUDPTunneling.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable RDP UPD tunneling"; Value = $HALB.EnableUDPTunneling.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Maximum TCP connections"; Value = $HALB.MaxTCPConnections.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Maximum TCP connections"; Value = $HALB.MaxTCPConnections.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Client inactivity timeout (s)"; Value = $HALB.ClientIdleTimeout.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Client inactivity timeout (s)"; Value = $HALB.ClientIdleTimeout.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Gateway connection timeout (s)"; Value = $HALB.GWConnectionTimeout.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Gateway connection timeout (s)"; Value = $HALB.GWConnectionTimeout.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Client connection queue timeout (s)"; Value = $HALB.ClientQueueTimeout.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Client connection queue timeout (s)"; Value = $HALB.ClientQueueTimeout.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Gateway inactivity timeout (s)"; Value = $HALB.GatewayIdleTimeout.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Gateway inactivity timeout (s)"; Value = $HALB.GatewayIdleTimeout.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Amount of TCP connections per second"; Value = $HALB.SessionsRate.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Amount of TCP connections per second"; Value = $HALB.SessionsRate.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Gateways health check intervals (s)"; Value = $HALB.GWHealthCheckInterval.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Gateways health check intervals (s)"; Value = $HALB.GWHealthCheckInterval.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "VRRP virtual router ID"; Value = $HALB.VirtualRouterID.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "VRRP virtual router ID"; Value = $HALB.VirtualRouterID.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "VRRP authentication password"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "VRRP authentication password"; Value = ""; }) > $Null
                                        $ScriptInformation.Add(@{Data = "VRRP broadcast interval (m)"; Value = $HALB.VrrpBroadcastInterval.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "VRRP broadcast interval (m)"; Value = $HALB.VrrpBroadcastInterval.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "VRRP health check script interval (s)"; Value = $HALB.VrrpHealthCheckInterval.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "VRRP health check script interval (s)"; Value = $HALB.VrrpHealthCheckInterval.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "VRRP health check script timeout"; Value = $HALB.VrrpHealthCheckTimeout.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "VRRP health check script timeout"; Value = $HALB.VrrpHealthCheckTimeout.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "VRRP advertisement interval (s)"; Value = $HALB.VrrpAdvertInterval.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "VRRP advertisement interval (s)"; Value = $HALB.VrrpAdvertInterval.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Enable OS updates"; Value = $HALB.OSUpdate.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Enable OS updates"; Value = $HALB.OSUpdate.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Keep existing load balancing settings"; Value = $HALB.KeepLBProxyConfig.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Keep existing load balancing settings"; Value = $HALB.KeepLBProxyConfig.ToString(); }) > $Null
                                        $ScriptInformation.Add(@{Data = "Keep existing VRRP/keepalive settings"; Value = $HALB.KeepVRRPConfig.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Keep existing VRRP/keepalive settings"; Value = $HALB.KeepVRRPConfig.ToString(); }) > $Null
 
                                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                                        -Columns Data,Value `                                   -Columns Data,Value `
                                        -List `                                   -List `
                                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                                        $Table.Columns.Item(1).Width = 200; <>                                 $Table.Columns.Item(1).Width = 200;
                                        $Table.Columns.Item(2).Width = 250;                                   $Table.Columns.Item(2).Width = 250;
 
                                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                                        $Table = $Null                                   $Table = $Null
                                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
                                }                           }
                                If($Text)                           If($Text)
                                {                           {
                                        Line 3 "Enable RDP UPD tunneling`t`t: " $HALB.EnableUDPTunneling.ToString()                                   Line 3 "Enable RDP UPD tunneling`t`t: " $HALB.EnableUDPTunneling.ToString()
                                        Line 3 "Maximum TCP connections`t`t`t: " $HALB.MaxTCPConnections.ToString()                                   Line 3 "Maximum TCP connections`t`t`t: " $HALB.MaxTCPConnections.ToString()
                                        Line 3 "Client inactivity timeout (s)`t`t: " $HALB.ClientIdleTimeout.ToString()                                   Line 3 "Client inactivity timeout (s)`t`t: " $HALB.ClientIdleTimeout.ToString()
                                        Line 3 "Gateway connection timeout (s)`t`t: " $HALB.GWConnectionTimeout.ToString()                                   Line 3 "Gateway connection timeout (s)`t`t: " $HALB.GWConnectionTimeout.ToString()
                                        Line 3 "Client connection queue timeout (s)`t: " $HALB.ClientQueueTimeout.ToString()                                   Line 3 "Client connection queue timeout (s)`t: " $HALB.ClientQueueTimeout.ToString()
                                        Line 3 "Gateway inactivity timeout (s)`t`t: " $HALB.GatewayIdleTimeout.ToString()                                   Line 3 "Gateway inactivity timeout (s)`t`t: " $HALB.GatewayIdleTimeout.ToString()
                                        Line 3 "Amount of TCP connections per second`t: " $HALB.SessionsRate.ToString()                                   Line 3 "Amount of TCP connections per second`t: " $HALB.SessionsRate.ToString()
                                        Line 3 "Gateways health check intervals (s)`t: " $HALB.GWHealthCheckInterval.ToString()                                   Line 3 "Gateways health check intervals (s)`t: " $HALB.GWHealthCheckInterval.ToString()
                                        Line 3 "VRRP virtual router ID`t`t`t: " $HALB.VirtualRouterID.ToString()                                   Line 3 "VRRP virtual router ID`t`t`t: " $HALB.VirtualRouterID.ToString()
                                        Line 3 "VRRP authentication password`t`t: "                                    Line 3 "VRRP authentication password`t`t: " 
                                        Line 3 "VRRP broadcast interval (m)`t`t: " $HALB.VrrpBroadcastInterval.ToString()                                   Line 3 "VRRP broadcast interval (m)`t`t: " $HALB.VrrpBroadcastInterval.ToString()
                                        Line 3 "VRRP health check script interval (s)`t: " $HALB.VrrpHealthCheckInterval.ToString()                                   Line 3 "VRRP health check script interval (s)`t: " $HALB.VrrpHealthCheckInterval.ToString()
                                        Line 3 "VRRP health check script timeout`t: " $HALB.VrrpHealthCheckTimeout.ToString()                                   Line 3 "VRRP health check script timeout`t: " $HALB.VrrpHealthCheckTimeout.ToString()
                                        Line 3 "VRRP advertisement interval (s)`t`t: " $HALB.VrrpAdvertInterval.ToString()                                   Line 3 "VRRP advertisement interval (s)`t`t: " $HALB.VrrpAdvertInterval.ToString()
                                        Line 3 "Enable OS updates`t`t`t: " $HALB.OSUpdate.ToString()                                   Line 3 "Enable OS updates`t`t`t: " $HALB.OSUpdate.ToString()
                                        Line 3 "Keep existing load balancing settings`t: " $HALB.KeepLBProxyConfig.ToString()                                   Line 3 "Keep existing load balancing settings`t: " $HALB.KeepLBProxyConfig.ToString()
                                        Line 3 "Keep existing VRRP/keepalive settings`t: " $HALB.KeepVRRPConfig.ToString()                                   Line 3 "Keep existing VRRP/keepalive settings`t: " $HALB.KeepVRRPConfig.ToString()
                                        Line 0 ""                                   Line 0 ""
                                }                           }
                                If($HTML)                           If($HTML)
                                {                           {
                                        $rowdata = @()                                   $rowdata = @()
                                        $columnHeaders = @("Enable RDP UPD tunneling",($Script:htmlsb),$HALB.EnableUDPTunneling.ToString(),$htmlwhite)                                   $columnHeaders = @("Enable RDP UPD tunneling",($Script:htmlsb),$HALB.EnableUDPTunneling.ToString(),$htmlwhite)
                                        $rowdata += @(,("Maximum TCP connections",($Script:htmlsb),$HALB.MaxTCPConnections.ToString(),$htmlwhite))                                   $rowdata += @(,("Maximum TCP connections",($Script:htmlsb),$HALB.MaxTCPConnections.ToString(),$htmlwhite))
                                        $rowdata += @(,("Client inactivity timeout (s)",($Script:htmlsb),$HALB.ClientIdleTimeout.ToString(),$htmlwhite))                                   $rowdata += @(,("Client inactivity timeout (s)",($Script:htmlsb),$HALB.ClientIdleTimeout.ToString(),$htmlwhite))
                                        $rowdata += @(,("Gateway connection timeout (s)",($Script:htmlsb),$HALB.GWConnectionTimeout.ToString(),$htmlwhite))                                   $rowdata += @(,("Gateway connection timeout (s)",($Script:htmlsb),$HALB.GWConnectionTimeout.ToString(),$htmlwhite))
                                        $rowdata += @(,("Client connection queue timeout (s)",($Script:htmlsb),$HALB.ClientQueueTimeout.ToString(),$htmlwhite))                                   $rowdata += @(,("Client connection queue timeout (s)",($Script:htmlsb),$HALB.ClientQueueTimeout.ToString(),$htmlwhite))
                                        $rowdata += @(,("Gateway inactivity timeout (s)",($Script:htmlsb),$HALB.GatewayIdleTimeout.ToString(),$htmlwhite))                                   $rowdata += @(,("Gateway inactivity timeout (s)",($Script:htmlsb),$HALB.GatewayIdleTimeout.ToString(),$htmlwhite))
                                        $rowdata += @(,("Amount of TCP connections per second",($Script:htmlsb),$HALB.SessionsRate.ToString(),$htmlwhite))                                   $rowdata += @(,("Amount of TCP connections per second",($Script:htmlsb),$HALB.SessionsRate.ToString(),$htmlwhite))
                                        $rowdata += @(,("Gateways health check intervals (s)",($Script:htmlsb),$HALB.GWHealthCheckInterval.ToString(),$htmlwhite))                                   $rowdata += @(,("Gateways health check intervals (s)",($Script:htmlsb),$HALB.GWHealthCheckInterval.ToString(),$htmlwhite))
                                        $rowdata += @(,("VRRP virtual router ID",($Script:htmlsb),$HALB.VirtualRouterID.ToString(),$htmlwhite))                                   $rowdata += @(,("VRRP virtual router ID",($Script:htmlsb),$HALB.VirtualRouterID.ToString(),$htmlwhite))
                                        $rowdata += @(,("VRRP authentication password",($Script:htmlsb),"",$htmlwhite))                                   $rowdata += @(,("VRRP authentication password",($Script:htmlsb),"",$htmlwhite))
                                        $rowdata += @(,("VRRP broadcast interval (m)",($Script:htmlsb),$HALB.VrrpBroadcastInterval.ToString(),$htmlwhite))                                   $rowdata += @(,("VRRP broadcast interval (m)",($Script:htmlsb),$HALB.VrrpBroadcastInterval.ToString(),$htmlwhite))
                                        $rowdata += @(,("VRRP health check script interval (s)",($Script:htmlsb),$HALB.VrrpHealthCheckInterval.ToString(),$htmlwhite))                                   $rowdata += @(,("VRRP health check script interval (s)",($Script:htmlsb),$HALB.VrrpHealthCheckInterval.ToString(),$htmlwhite))
                                        $rowdata += @(,("VRRP health check script timeout",($Script:htmlsb),$HALB.VrrpHealthCheckTimeout.ToString(),$htmlwhite))                                   $rowdata += @(,("VRRP health check script timeout",($Script:htmlsb),$HALB.VrrpHealthCheckTimeout.ToString(),$htmlwhite))
                                        $rowdata += @(,("VRRP advertisement interval (s)",($Script:htmlsb),$HALB.VrrpAdvertInterval.ToString(),$htmlwhite))                                   $rowdata += @(,("VRRP advertisement interval (s)",($Script:htmlsb),$HALB.VrrpAdvertInterval.ToString(),$htmlwhite))
                                        $rowdata += @(,("Enable OS updates",($Script:htmlsb),$HALB.OSUpdate.ToString(),$htmlwhite))                                   $rowdata += @(,("Enable OS updates",($Script:htmlsb),$HALB.OSUpdate.ToString(),$htmlwhite))
                                        $rowdata += @(,("Keep existing load balancing settings",($Script:htmlsb),$HALB.KeepLBProxyConfig.ToString(),$htmlwhite))                                   $rowdata += @(,("Keep existing load balancing settings",($Script:htmlsb),$HALB.KeepLBProxyConfig.ToString(),$htmlwhite))
                                        $rowdata += @(,("Keep existing VRRP/keepalive settings",($Script:htmlsb),$HALB.KeepVRRPConfig.ToString(),$htmlwhite))                                   $rowdata += @(,("Keep existing VRRP/keepalive settings",($Script:htmlsb),$HALB.KeepVRRPConfig.ToString(),$htmlwhite))
 
                                        $msg = "Advanced" <>                                 $msg = "Advanced"
                                        $columnWidths = @("200","400")                                   $columnWidths = @("200","400")
                                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                }                           }
                        }                   }
                }           }
        }    
 
                        $ThemeHTML5PrelogonMessage    = $Theme.HTML5Client.Message.PreLogonMessage.Split("`n") <>                         $ThemeUserPortalPrelogonMessage    = $Theme.UserPortal.Message.PreLogonMessage.Split("`n")
                        $ThemeHTML5PostlogonMessage   = $Theme.HTML5Client.Message.HTML5PostLogonMessage.Split("`n")                           $ThemeUserPortalPostlogonMessage   = $Theme.UserPortal.Message.UserPortalPostLogonMessage.Split("`n")
 
                        $ThemeHTML5URL                = "https://FQDN/$($Theme.HTML5Client.Url.LoginPageURLPath)" <>                         $ThemeUserPortalURL                = "https://FQDN/$($Theme.UserPortal.Url.LoginPageURLPath)"
                        $ThemeShowDownloadURL         = $Theme.HTML5Client.Url.ShowDownloadURL.ToString()                           $ThemeShowDownloadURL         = $Theme.UserPortal.Url.ShowDownloadURL.ToString()
                        $ThemeOverrideDownloadURL     = $Theme.HTML5Client.Url.OverrideWindowsClientDownloadURL                           $ThemeOverrideDownloadURL     = $Theme.UserPortal.Url.OverrideWindowsClientDownloadURL
 
                        $ThemeHTML5LaunchSessionsUsing = "" <>                         $ThemeUserPortalLaunchSessionsUsing = ""
                        Switch($Theme.HTML5Client.Gateway.LaunchMethod)                           Switch($Theme.UserPortal.Gateway.LaunchMethod)
 
                                        $ThemeHTML5LaunchSessionsUsing = "Launch apps with Parallels Client & Fallback to HTML5"; Break <>                                         $ThemeUserPortalLaunchSessionsUsing = "Launch apps with Parallels Client & Fallback to HTML5"; Break
 
                                        $ThemeHTML5LaunchSessionsUsing = "Launch apps with Parallels Client"; Break <>                                         $ThemeUserPortalLaunchSessionsUsing = "Launch apps with Parallels Client"; Break
 
                                        $ThemeHTML5LaunchSessionsUsing = "Launch apps in Browser only (HTML5 Only)"; Break <>                                         $ThemeUserPortalLaunchSessionsUsing = "Launch apps in Browser only (HTML5 Only)"; Break
 
                                        $ThemeHTML5LaunchSessionsUsing = "Unable to determine Launch sessions using: $($Theme.HTML5Client.Gateway.LaunchMethod)"; Break <>                                         $ThemeUserPortalLaunchSessionsUsing = "Unable to determine Launch sessions using: $($Theme.UserPortal.Gateway.LaunchMethod)"; Break
 
                        Switch($Theme.HTML5Client.Gateway.FileTransferMode) <>                         Switch($Theme.UserPortal.Gateway.FileTransferMode)
 
                                Default                         {$ThemeHTMLFileTransfer = "Unable to determine File transfer mode: $($Theme.HTML5Client.Gateway.FileTransferMode)"; Break} <>                                 Default                         {$ThemeHTMLFileTransfer = "Unable to determine File transfer mode: $($Theme.UserPortal.Gateway.FileTransferMode)"; Break}
 
                        Switch($Theme.HTML5Client.Gateway.ClipboardDirection) <>                         Switch($Theme.UserPortal.Gateway.ClipboardDirection)
 
                                Default                         {$ThemeHTMLClipboardDirection = "Unable to determine Clipboard direction: $($Theme.HTML5Client.Gateway.ClipboardDirection)"; Break} <>                                 Default                         {$ThemeHTMLClipboardDirection = "Unable to determine Clipboard direction: $($Theme.UserPortal.Gateway.ClipboardDirection)"; Break}
 
                                $ScriptInformation.Add(@{Data = "HTML5 URL"; Value = $ThemeHTML5URL; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "HTML5 URL"; Value = $ThemeUserPortalURL; }) > $Null
 
                                Line 3 "HTML5 URL`t`t: " $ThemeHTML5URL <>                                 Line 3 "HTML5 URL`t`t: " $ThemeUserPortalURL
 
                                $rowdata += @(,("HTML5 URL",($Script:htmlsb),$ThemeHTML5URL,$htmlwhite)) <>                                 $rowdata += @(,("HTML5 URL",($Script:htmlsb),$ThemeUserPortalURL,$htmlwhite))
 
                                WriteWordLine 4 0 "HTML5 client/URLs" <>                                 WriteWordLine 4 0 "User Portal (Web client)"
 
                                Line 2 "HTML5 client/URLs" <>                                 Line 2 "User Portal (Web client)"
 
                                $ScriptInformation.Add(@{Data = "Theme login page:"; Value = $ThemeHTML5URL; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Theme login page:"; Value = $ThemeUserPortalURL; }) > $Null
 
                                Line 3 "Theme login page`t`t  : " $ThemeHTML5URL <>                                 Line 3 "Theme login page`t`t  : " $ThemeUserPortalURL
 
                                $columnHeaders = @("Theme login page:",($Script:htmlsb),$ThemeHTML5URL,$htmlwhite) <>                                 $columnHeaders = @("Theme login page:",($Script:htmlsb),$ThemeUserPortalURL,$htmlwhite)
 
                                $msg = "HTML5 client/URLs" <>                                 $msg = "User Portal (Web client)"
 
                                WriteWordLine 4 0 "HTML5 client/Branding" <>                                 WriteWordLine 4 0 "User Portal (Web client)/Branding"
 
                                Line 2 "HTML5 client/Branding" <>                                 Line 2 "User Portal (Web client)/Branding"
 
                                $ScriptInformation.Add(@{Data = "Webpage title"; Value = $Theme.HTML5Client.Branding.WebpageTitle; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Webpage title"; Value = $Theme.UserPortal.Branding.WebpageTitle; }) > $Null
                                $ScriptInformation.Add(@{Data = "Login to"; Value = $Theme.HTML5Client.Branding.LoginTo; }) > $Null                                   $ScriptInformation.Add(@{Data = "Login to"; Value = $Theme.UserPortal.Branding.LoginTo; }) > $Null
 
                                Line 3 "Webpage title`t: " $Theme.HTML5Client.Branding.WebpageTitle <>                                 Line 3 "Webpage title`t: " $Theme.UserPortal.Branding.WebpageTitle
                                Line 3 "Login to`t: " $Theme.HTML5Client.Branding.LoginTo                                   Line 3 "Login to`t: " $Theme.UserPortal.Branding.LoginTo
 
                                $columnHeaders = @("Webpage title",($Script:htmlsb),$Theme.HTML5Client.Branding.WebpageTitle,$htmlwhite) <>                                 $columnHeaders = @("Webpage title",($Script:htmlsb),$Theme.UserPortal.Branding.WebpageTitle,$htmlwhite)
                                $rowdata += @(,("Login to",($Script:htmlsb),$Theme.HTML5Client.Branding.LoginTo,$htmlwhite))                                   $rowdata += @(,("Login to",($Script:htmlsb),$Theme.UserPortal.Branding.LoginTo,$htmlwhite))
 
                                $msg = "HTML5 client/Branding" <>                                 $msg = "User Portal (Web client)/Branding"
 
                                WriteWordLine 4 0 "HTML5 client/Language bar" <>                                 WriteWordLine 4 0 "User Portal (Web client)/Language bar"
 
                                Line 2 "HTML5 client/Language bar" <>                                 Line 2 "User Portal (Web client)/Language bar"
 
                                $ScriptInformation.Add(@{Data = "Default language"   ; Value = $Theme.HTML5Client.LanguageBar.Default.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Default language"   ; Value = $Theme.UserPortal.LanguageBar.Default.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "English"            ; Value = $Theme.HTML5Client.LanguageBar.en_US.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "English"            ; Value = $Theme.UserPortal.LanguageBar.en_US.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "German"             ; Value = $Theme.HTML5Client.LanguageBar.de_DE.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "German"             ; Value = $Theme.UserPortal.LanguageBar.de_DE.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Japanese"           ; Value = $Theme.HTML5Client.LanguageBar.ja_JP.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Japanese"           ; Value = $Theme.UserPortal.LanguageBar.ja_JP.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Russian"            ; Value = $Theme.HTML5Client.LanguageBar.ru_RU.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Russian"            ; Value = $Theme.UserPortal.LanguageBar.ru_RU.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "French"             ; Value = $Theme.HTML5Client.LanguageBar.fr_FR.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "French"             ; Value = $Theme.UserPortal.LanguageBar.fr_FR.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Spanish"            ; Value = $Theme.HTML5Client.LanguageBar.es_ES.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Spanish"            ; Value = $Theme.UserPortal.LanguageBar.es_ES.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Italian"            ; Value = $Theme.HTML5Client.LanguageBar.it_IT.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Italian"            ; Value = $Theme.UserPortal.LanguageBar.it_IT.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Portuguese"         ; Value = $Theme.HTML5Client.LanguageBar.pt_BR.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Portuguese"         ; Value = $Theme.UserPortal.LanguageBar.pt_BR.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Chinese Simplified" ; Value = $Theme.HTML5Client.LanguageBar.zh_CN.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Chinese Simplified" ; Value = $Theme.UserPortal.LanguageBar.zh_CN.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Chinese Traditional"; Value = $Theme.HTML5Client.LanguageBar.zh_TW.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Chinese Traditional"; Value = $Theme.UserPortal.LanguageBar.zh_TW.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Korean"             ; Value = $Theme.HTML5Client.LanguageBar.ko_KR.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Korean"             ; Value = $Theme.UserPortal.LanguageBar.ko_KR.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "Dutch"              ; Value = $Theme.HTML5Client.LanguageBar.nl_NL.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Dutch"              ; Value = $Theme.UserPortal.LanguageBar.nl_NL.ToString(); }) > $Null
 
                                Line 3 "Default language`t: "    $Theme.HTML5Client.LanguageBar.Default.ToString() <>                                 Line 3 "Default language`t: "    $Theme.UserPortal.LanguageBar.Default.ToString()
                                Line 3 "English`t`t`t: "         $Theme.HTML5Client.LanguageBar.en_US.ToString()                                   Line 3 "English`t`t`t: "         $Theme.UserPortal.LanguageBar.en_US.ToString()
                                Line 3 "German`t`t`t: "          $Theme.HTML5Client.LanguageBar.de_DE.ToString()                                   Line 3 "German`t`t`t: "          $Theme.UserPortal.LanguageBar.de_DE.ToString()
                                Line 3 "Japanese`t`t: "          $Theme.HTML5Client.LanguageBar.ja_JP.ToString()                                   Line 3 "Japanese`t`t: "          $Theme.UserPortal.LanguageBar.ja_JP.ToString()
                                Line 3 "Russian`t`t`t: "         $Theme.HTML5Client.LanguageBar.ru_RU.ToString()                                   Line 3 "Russian`t`t`t: "         $Theme.UserPortal.LanguageBar.ru_RU.ToString()
                                Line 3 "French`t`t`t: "          $Theme.HTML5Client.LanguageBar.fr_FR.ToString()                                   Line 3 "French`t`t`t: "          $Theme.UserPortal.LanguageBar.fr_FR.ToString()
                                Line 3 "Spanish`t`t`t: "         $Theme.HTML5Client.LanguageBar.es_ES.ToString()                                   Line 3 "Spanish`t`t`t: "         $Theme.UserPortal.LanguageBar.es_ES.ToString()
                                Line 3 "Italian`t`t`t: "         $Theme.HTML5Client.LanguageBar.it_IT.ToString()                                   Line 3 "Italian`t`t`t: "         $Theme.UserPortal.LanguageBar.it_IT.ToString()
                                Line 3 "Portuguese`t`t: "        $Theme.HTML5Client.LanguageBar.pt_BR.ToString()                                   Line 3 "Portuguese`t`t: "        $Theme.UserPortal.LanguageBar.pt_BR.ToString()
                                Line 3 "Chinese Simplified`t: "  $Theme.HTML5Client.LanguageBar.zh_CN.ToString()                                   Line 3 "Chinese Simplified`t: "  $Theme.UserPortal.LanguageBar.zh_CN.ToString()
                                Line 3 "Chinese Traditional`t: " $Theme.HTML5Client.LanguageBar.zh_TW.ToString()                                   Line 3 "Chinese Traditional`t: " $Theme.UserPortal.LanguageBar.zh_TW.ToString()
                                Line 3 "Korean`t`t`t: "          $Theme.HTML5Client.LanguageBar.ko_KR.ToString()                                   Line 3 "Korean`t`t`t: "          $Theme.UserPortal.LanguageBar.ko_KR.ToString()
                                Line 3 "Dutch`t`t`t: "           $Theme.HTML5Client.LanguageBar.nl_NL.ToString()                                   Line 3 "Dutch`t`t`t: "           $Theme.UserPortal.LanguageBar.nl_NL.ToString()
 
                                $columnHeaders = @("Default language",($Script:htmlsb),$Theme.HTML5Client.LanguageBar.Default.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Default language",($Script:htmlsb),$Theme.UserPortal.LanguageBar.Default.ToString(),$htmlwhite)
                                $rowdata += @(,("English"            ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.en_US.ToString(),$htmlwhite))                                   $rowdata += @(,("English"            ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.en_US.ToString(),$htmlwhite))
                                $rowdata += @(,("German"             ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.de_DE.ToString(),$htmlwhite))                                   $rowdata += @(,("German"             ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.de_DE.ToString(),$htmlwhite))
                                $rowdata += @(,("Japanese"           ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.ja_JP.ToString(),$htmlwhite))                                   $rowdata += @(,("Japanese"           ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.ja_JP.ToString(),$htmlwhite))
                                $rowdata += @(,("Russian"            ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.ru_RU.ToString(),$htmlwhite))                                   $rowdata += @(,("Russian"            ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.ru_RU.ToString(),$htmlwhite))
                                $rowdata += @(,("French"             ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.fr_FR.ToString(),$htmlwhite))                                   $rowdata += @(,("French"             ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.fr_FR.ToString(),$htmlwhite))
                                $rowdata += @(,("Spanish"            ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.es_ES.ToString(),$htmlwhite))                                   $rowdata += @(,("Spanish"            ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.es_ES.ToString(),$htmlwhite))
                                $rowdata += @(,("Italian"            ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.it_IT.ToString(),$htmlwhite))                                   $rowdata += @(,("Italian"            ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.it_IT.ToString(),$htmlwhite))
                                $rowdata += @(,("Portuguese"         ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.pt_BR.ToString(),$htmlwhite))                                   $rowdata += @(,("Portuguese"         ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.pt_BR.ToString(),$htmlwhite))
                                $rowdata += @(,("Chinese Simplified" ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.zh_CN.ToString(),$htmlwhite))                                   $rowdata += @(,("Chinese Simplified" ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.zh_CN.ToString(),$htmlwhite))
                                $rowdata += @(,("Chinese Traditional",($Script:htmlsb),$Theme.HTML5Client.LanguageBar.zh_TW.ToString(),$htmlwhite))                                   $rowdata += @(,("Chinese Traditional",($Script:htmlsb),$Theme.UserPortal.LanguageBar.zh_TW.ToString(),$htmlwhite))
                                $rowdata += @(,("Korean"             ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.ko_KR.ToString(),$htmlwhite))                                   $rowdata += @(,("Korean"             ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.ko_KR.ToString(),$htmlwhite))
                                $rowdata += @(,("Dutch"              ,($Script:htmlsb),$Theme.HTML5Client.LanguageBar.nl_NL.ToString(),$htmlwhite))                                   $rowdata += @(,("Dutch"              ,($Script:htmlsb),$Theme.UserPortal.LanguageBar.nl_NL.ToString(),$htmlwhite))
 
                                $msg = "HTML5 client/Language bar" <>                                 $msg = "User Portal (Web client)/Language bar"
 
                                WriteWordLine 4 0 "HTML5 client/Messages" <>                                 WriteWordLine 4 0 "User Portal (Web client)/Messages"
 
                                Line 2 "HTML5 client/Messages" <>                                 Line 2 "User Portal (Web client)/Messages"
 
                                ForEach($line in $ThemeHTML5PrelogonMessage) <>                                 ForEach($line in $ThemeUserPortalPrelogonMessage)
 
                                $ScriptInformation.Add(@{Data = "Override post-logon message"; Value = $Theme.HTML5Client.Message.OverridePostLogonMessage.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Override post-logon message"; Value = $Theme.UserPortal.Message.OverridePostLogonMessage.ToString(); }) > $Null
                                If($Theme.HTML5Client.Message.OverridePostLogonMessage)                                   If($Theme.UserPortal.Message.OverridePostLogonMessage)
 
                                        ForEach($line in $ThemeHTML5PostlogonMessage) <>                                         ForEach($line in $ThemeUserPortalPostlogonMessage)
 
                                ForEach($line in $ThemeHTML5PrelogonMessage) <>                                 ForEach($line in $ThemeUserPortalPrelogonMessage)
 
                                Line 3 "Override post-logon message: " $Theme.HTML5Client.Message.OverridePostLogonMessage.ToString() <>                                 Line 3 "Override post-logon message: " $Theme.UserPortal.Message.OverridePostLogonMessage.ToString()
                                If($Theme.HTML5Client.Message.OverridePostLogonMessage)                                   If($Theme.UserPortal.Message.OverridePostLogonMessage)
 
                                        ForEach($line in $ThemeHTML5PostlogonMessage) <>                                         ForEach($line in $ThemeUserPortalPostlogonMessage)
 
                                ForEach($line in $ThemeHTML5PrelogonMessage) <>                                 ForEach($line in $ThemeUserPortalPrelogonMessage)
 
                                $msg = "HTML5 client/Messages" <>                                 $msg = "User Portal (Web client)/Messages"
 
                                $columnHeaders = @("Override post-logon message",($Script:htmlsb),$Theme.HTML5Client.Message.OverridePostLogonMessage.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Override post-logon message",($Script:htmlsb),$Theme.UserPortal.Message.OverridePostLogonMessage.ToString(),$htmlwhite)
                                If($Theme.HTML5Client.Message.OverridePostLogonMessage)                                   If($Theme.UserPortal.Message.OverridePostLogonMessage)
 
                                        ForEach($line in $ThemeHTML5PostlogonMessage) <>                                         ForEach($line in $ThemeUserPortalPostlogonMessage)
 
  <>                                 WriteWordLine 4 0 "User Portal (Web client)/Input prompt"
                            }
                            If($Text)
                            {
                                    Line 2 "User Portal (Web client)/Input prompt"
                            }
                            If($HTML)
                            {
                                    #Nothing
                            }
                            
                            $InputPromptTable = @()
                            
                            $InputPromptTable += @{
                                    Language = "German"
                                    LoginHint = $Theme.UserPortal.InputPrompt.de_DE.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.de_DE.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "English"
                                    LoginHint = $Theme.UserPortal.InputPrompt.en_US.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.en_US.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Japanese"
                                    LoginHint = $Theme.UserPortal.InputPrompt.ja_JP.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.ja_JP.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Russian"
                                    LoginHint = $Theme.UserPortal.InputPrompt.ru_RU.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.ru_RU.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "French"
                                    LoginHint = $Theme.UserPortal.InputPrompt.fr_FR.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.fr_FR.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Spanish"
                                    LoginHint = $Theme.UserPortal.InputPrompt.es_ES.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.es_ES.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Italian"
                                    LoginHint = $Theme.UserPortal.InputPrompt.it_IT.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.it_IT.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Portuguese"
                                    LoginHint = $Theme.UserPortal.InputPrompt.pt_BR.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.pt_BR.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Chinese Simplified"
                                    LoginHint = $Theme.UserPortal.InputPrompt.zh_CN.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.zh_CN.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Chinese Traditional"
                                    LoginHint = $Theme.UserPortal.InputPrompt.zh_TW.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.zh_TW.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Korean"
                                    LoginHint = $Theme.UserPortal.InputPrompt.ko_KR.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.ko_KR.PasswordHint
                            }
     
                            $InputPromptTable += @{
                                    Language = "Dutch"
                                    LoginHint = $Theme.UserPortal.InputPrompt.nl_NL.LoginHint
                                    PasswordHint = $Theme.UserPortal.InputPrompt.nl_NL.PasswordHint
                            }
     
                            If($MSWord -or $PDF)
                            {
                                    $ScriptInformation = New-Object System.Collections.ArrayList
     
                                    If($InputPromptTable.Count -gt 0)
                                    {
                                            $Table = AddWordTable -Hashtable $InputPromptTable `
                                            -Columns Language, LoginHint, PasswordHint `
                                            -Headers "Language", "Login hint", "Password hint" `
                                            -Format $wdTableGrid `
                                            -AutoFit $wdAutoFitFixed;
     
                                            SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                                            SetWordCellFormat -Collection $Table.Rows.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                                            $Table.Columns.Item(1).Width = 100;
                                            $Table.Columns.Item(2).Width = 100;
                                            $Table.Columns.Item(3).Width = 100;
                                            
                                            $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                                            FindWordDocumentEnd
                                            $Table = $Null
                                            WriteWordLine 0 0 ""
                                    }
                            }
                            If($Text)
                            {
                                    Line 3 "Language             Login hint           Password hint"
                                    Line 3 "======================================================="
                                    #       1234567890123456789SS1234567890123456789SS1234567890123
                                    #               Chinese Traditional  utilisateur@domaine  mot de passe
     
                                    ForEach($Item in $InputPromptTable)
                                    {
                                            Line 3 ( "{0,-19}  {1,-19}  {2,-13}" -f 
                                                    $Item.Language, 
                                                    $Item.LoginHint, 
                                                    $Item.PasswordHint
                                            )
                                    }
                                    
                                    Line 0 ""
                            }
                            If($HTML)
                            {
                                    $rowdata = @()
     
                                    ForEach($Item in $InputPromptTable)
                                    {
                                            $rowdata += @(,(
                                                    $Item.Language,$htmlwhite,
                                                    $Item.LoginHint,$htmlwhite,
                                                    $Item.PasswordHint,$htmlwhite)
                                            )
                                    }
                                    
                                    $columnHeaders = @(
                                            "Language",($Script:htmlsb),
                                            "Login hint",($Script:htmlsb),
                                            "Pasword hint",($Script:htmlsb)
                                    )
     
                                    $msg = "User Portal (Web client)/Input prompt"
                                    $columnWidths = @("110","100","100")
                                    FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                                    WriteHTMLLine 0 0 ""
                            }
     
                            If($MSWord -or $PDF)
                            {
                                WriteWordLine 4 0 "HTML5 client/Gateway"                                   WriteWordLine 4 0 "User Portal (Web client)/Secure Gateway"
 
                                Line 2 "HTML5 client/Gateway" <>                                 Line 2 "User Portal (Web client)/Secure Gateway"
 
                                $ScriptInformation.Add(@{Data = "Override gateway settings for theme"; Value = $Theme.HTML5Client.Gateway.OverrideGWSettings.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Override Secure Gateway settings for theme"; Value = $Theme.UserPortal.Gateway.OverrideGatewaySettings.ToString(); }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Launch sessions using"; Value = $ThemeHTML5LaunchSessionsUsing; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Launch sessions using"; Value = $ThemeUserPortalLaunchSessionsUsing; }) > $Null
                                Switch($Theme.HTML5Client.Gateway.LaunchMethod)                                   Switch($Theme.UserPortal.Gateway.LaunchMethod)
 
                                                $ScriptInformation.Add(@{Data = "     Allow user to select a launch method"; Value = $Theme.HTML5Client.Gateway.AllowLaunchMethod.ToString(); }) > $Null <>                                                 $ScriptInformation.Add(@{Data = "     Allow user to select a launch method"; Value = $Theme.UserPortal.Gateway.AllowLaunchMethod.ToString(); }) > $Null
                                                $ScriptInformation.Add(@{Data = "     Allow opening applications in a new tab"; Value = $Theme.HTML5Client.Gateway.AllowAppsInNewTab.ToString(); }) > $Null                                                   $ScriptInformation.Add(@{Data = "     Allow opening applications in a new tab"; Value = $Theme.UserPortal.Gateway.AllowAppsInNewTab.ToString(); }) > $Null
 
                                                $ScriptInformation.Add(@{Data = "     Allow opening applications in a new tab"; Value = $Theme.HTML5Client.Gateway.AllowAppsInNewTab.ToString(); }) > $Null <>                                                 $ScriptInformation.Add(@{Data = "     Allow opening applications in a new tab"; Value = $Theme.UserPortal.Gateway.AllowAppsInNewTab.ToString(); }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Use Pre Windows 2000 login format"; Value = $Theme.HTML5Client.Gateway.Pre2000Cred.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Use Pre Windows 2000 login format"; Value = $Theme.UserPortal.Gateway.Pre2000Cred.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "     Allow embedding of Parallels HTML5 Client into other web pages"; Value = $Theme.HTML5Client.Gateway.AllowEmbed.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "     Allow embedding of User Portal into other web pages"; Value = $Theme.UserPortal.Gateway.AllowEmbed.ToString(); }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Allow cross-origin resource sharing"; Value = $Theme.HTML5Client.Gateway.AllowCORS.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Allow cross-origin resource sharing"; Value = $Theme.UserPortal.Gateway.AllowCORS.ToString(); }) > $Null
                                If($Theme.HTML5Client.Gateway.AllowCORS)                                   If($Theme.UserPortal.Gateway.AllowCORS)
 
                                        ForEach($Domain in $Theme.HTML5Client.Gateway.AllowedDomainsForCORS) <>                                         ForEach($Domain in $Theme.UserPortal.Gateway.AllowedDomainsForCORS)
 
                                        $ScriptInformation.Add(@{Data = "Browser cache time"; Value = "$($Theme.HTML5Client.Gateway.BrowserCacheTimeInMonths.ToString()) months"; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "Browser cache time"; Value = "$($Theme.UserPortal.Gateway.BrowserCacheTimeInMonths.ToString()) months"; }) > $Null
 
                                Line 3 "Override gateway settings for theme: " $Theme.HTML5Client.Gateway.OverrideGWSettings.ToString() <>                                 Line 3 "Override Secure Gateway settings for theme: " $Theme.UserPortal.Gateway.OverrideGatewaySettings.ToString()
 
                                Line 4 "Launch sessions using`t`t`t: " $ThemeHTML5LaunchSessionsUsing <>                                 Line 4 "Launch sessions using`t`t`t: " $ThemeUserPortalLaunchSessionsUsing
                                Switch($Theme.HTML5Client.Gateway.LaunchMethod)                                   Switch($Theme.UserPortal.Gateway.LaunchMethod)
 
                                                Line 4 "Allow user to select a launch method`t: " $Theme.HTML5Client.Gateway.AllowLaunchMethod.ToString() <>                                                 Line 4 "Allow user to select a launch method`t: " $Theme.UserPortal.Gateway.AllowLaunchMethod.ToString()
                                                Line 4 "Allow opening applications in a new tab`t: " $Theme.HTML5Client.Gateway.AllowAppsInNewTab.ToString()                                                   Line 4 "Allow opening applications in a new tab`t: " $Theme.UserPortal.Gateway.AllowAppsInNewTab.ToString()
 
                                                Line 4 "Allow opening applications in a new tab`t: " $Theme.HTML5Client.Gateway.AllowAppsInNewTab.ToString() <>                                                 Line 4 "Allow opening applications in a new tab`t: " $Theme.UserPortal.Gateway.AllowAppsInNewTab.ToString()
 
                                Line 4 "Use Pre Windows 2000 login format`t: " $Theme.HTML5Client.Gateway.Pre2000Cred.ToString() <>                                 Line 4 "Use Pre Windows 2000 login format`t: " $Theme.UserPortal.Gateway.Pre2000Cred.ToString()
                                Line 4 "Allow embedding of Parallels HTML5 "                                   Line 4 "Allow embedding of User Portal "
                                Line 4 "Client into other web pages`t`t: " $Theme.HTML5Client.Gateway.AllowEmbed.ToString()                                   Line 4 "Client into other web pages`t`t: " $Theme.UserPortal.Gateway.AllowEmbed.ToString()
 
                                Line 4 "Allow cross-origin resource sharing`t: " $Theme.HTML5Client.Gateway.AllowCORS.ToString() <>                                 Line 4 "Allow cross-origin resource sharing`t: " $Theme.UserPortal.Gateway.AllowCORS.ToString()
                                If($Theme.HTML5Client.Gateway.AllowCORS)                                   If($Theme.UserPortal.Gateway.AllowCORS)
 
                                        ForEach($Domain in $Theme.HTML5Client.Gateway.AllowedDomainsForCORS) <>                                         ForEach($Domain in $Theme.UserPortal.Gateway.AllowedDomainsForCORS)
 
                                        Line 5 "Browser cache time`t`t: "  "$($Theme.HTML5Client.Gateway.BrowserCacheTimeInMonths.ToString()) months" <>                                         Line 5 "Browser cache time`t`t: "  "$($Theme.UserPortal.Gateway.BrowserCacheTimeInMonths.ToString()) months"
 
                                $columnHeaders = @("Override gateway settings for theme",($Script:htmlsb),$Theme.HTML5Client.Gateway.OverrideGWSettings.ToString(),$htmlwhite) <>                                 $columnHeaders = @("Override Secure Gateway settings for theme",($Script:htmlsb),$Theme.UserPortal.Gateway.OverrideGatewaySettings.ToString(),$htmlwhite)
 
                                $rowdata += @(,("     Launch sessions using",($Script:htmlsb),$ThemeHTML5LaunchSessionsUsing,$htmlwhite)) <>                                 $rowdata += @(,("     Launch sessions using",($Script:htmlsb),$ThemeUserPortalLaunchSessionsUsing,$htmlwhite))
                                Switch($Theme.HTML5Client.Gateway.LaunchMethod)                                   Switch($Theme.UserPortal.Gateway.LaunchMethod)
 
                                                $rowdata += @(,("     Allow user to select a launch method",($Script:htmlsb),$Theme.HTML5Client.Gateway.AllowLaunchMethod.ToString(),$htmlwhite)) <>                                                 $rowdata += @(,("     Allow user to select a launch method",($Script:htmlsb),$Theme.UserPortal.Gateway.AllowLaunchMethod.ToString(),$htmlwhite))
                                                $rowdata += @(,("     Allow opening applications in a new tab",($Script:htmlsb), $Theme.HTML5Client.Gateway.AllowAppsInNewTab.ToString(),$htmlwhite))                                                   $rowdata += @(,("     Allow opening applications in a new tab",($Script:htmlsb), $Theme.UserPortal.Gateway.AllowAppsInNewTab.ToString(),$htmlwhite))
 
                                                $rowdata += @(,("     Allow opening applications in a new tab",($Script:htmlsb), $Theme.HTML5Client.Gateway.AllowAppsInNewTab.ToString(),$htmlwhite)) <>                                                 $rowdata += @(,("     Allow opening applications in a new tab",($Script:htmlsb), $Theme.UserPortal.Gateway.AllowAppsInNewTab.ToString(),$htmlwhite))
 
                                $rowdata += @(,("     Use Pre Windows 2000 login format",($Script:htmlsb), $Theme.HTML5Client.Gateway.Pre2000Cred.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("     Use Pre Windows 2000 login format",($Script:htmlsb), $Theme.UserPortal.Gateway.Pre2000Cred.ToString(),$htmlwhite))
                                $rowdata += @(,("     Allow embedding of Parallels HTML5 Client into other web pages",($Script:htmlsb), $Theme.HTML5Client.Gateway.AllowEmbed.ToString(),$htmlwhite))                                   $rowdata += @(,("     Allow embedding of User Portal into other web pages",($Script:htmlsb), $Theme.UserPortal.Gateway.AllowEmbed.ToString(),$htmlwhite))
 
                                $rowdata += @(,("     Allow cross-origin resource sharing",($Script:htmlsb),$Theme.HTML5Client.Gateway.AllowCORS.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("     Allow cross-origin resource sharing",($Script:htmlsb),$Theme.UserPortal.Gateway.AllowCORS.ToString(),$htmlwhite))
                                If($Theme.HTML5Client.Gateway.AllowCORS)                                   If($Theme.UserPortal.Gateway.AllowCORS)
 
                                        ForEach($Domain in $Theme.HTML5Client.Gateway.AllowedDomainsForCORS) <>                                         ForEach($Domain in $Theme.UserPortal.Gateway.AllowedDomainsForCORS)
 
                                        $rowdata += @(,("Browser cache time",($Script:htmlsb),"$($Theme.HTML5Client.Gateway.BrowserCacheTimeInMonths.ToString()) months",$htmlwhite)) <>                                         $rowdata += @(,("Browser cache time",($Script:htmlsb),"$($Theme.UserPortal.Gateway.BrowserCacheTimeInMonths.ToString()) months",$htmlwhite))
 
                                $msg = "HTML5 client/Gateway" <>                                 $msg = "User Portal (Web client)/Secure Gateway"
 
                                WriteWordLine 4 0 "HTML5 client/Legal policies" <>                                 WriteWordLine 4 0 "User Portal (Web client)/Legal policies"
 
                                Line 2 "HTML5 client/Legal policies" <>                                 Line 2 "User Portal (Web client)/Legal policies"
 
                                $ScriptInformation.Add(@{Data = "     Enable cookie consent"; Value = $Theme.HTML5Client.LegalPolicies.AllowCookieConsent.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Enable cookie consent"; Value = $Theme.UserPortal.LegalPolicies.AllowCookieConsent.ToString(); }) > $Null
 
                                $ScriptInformation.Add(@{Data = "     Enable EULA"; Value = $Theme.HTML5Client.LegalPolicies.AllowEULA.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "     Enable EULA"; Value = $Theme.UserPortal.LegalPolicies.AllowEULA.ToString(); }) > $Null
 
                                Line 4 "Enable cookie consent`t: " $Theme.HTML5Client.LegalPolicies.AllowCookieConsent.ToString() <>                                 Line 4 "Enable cookie consent`t: " $Theme.UserPortal.LegalPolicies.AllowCookieConsent.ToString()
 
                                Line 4 "Enable EULA`t`t: " $Theme.HTML5Client.LegalPolicies.AllowEULA.ToString() <>                                 Line 4 "Enable EULA`t`t: " $Theme.UserPortal.LegalPolicies.AllowEULA.ToString()
 
                                $rowdata += @(,("     Enable cookie consent",($Script:htmlsb),$Theme.HTML5Client.LegalPolicies.AllowCookieConsent.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("     Enable cookie consent",($Script:htmlsb),$Theme.UserPortal.LegalPolicies.AllowCookieConsent.ToString(),$htmlwhite))
 
                                $rowdata += @(,("     Enable EULA",($Script:htmlsb), $Theme.HTML5Client.LegalPolicies.AllowEULA.ToString(),$htmlwhite)) <>                                 $rowdata += @(,("     Enable EULA",($Script:htmlsb), $Theme.UserPortal.LegalPolicies.AllowEULA.ToString(),$htmlwhite))
 
                                $msg = "HTML5 client/Legal policies" <>                                 $msg = "User Portal (Web client)/Legal policies"
 
                Unable to retrieve Certificates for Site $($Site.Name)` <>                 Unable to retrieve Settings for Site $($Site.Name)`
 
                        WriteWordLine 0 0 "Unable to retrieve Certificates for Site $($Site.Name)" <>                         WriteWordLine 0 0 "Unable to retrieve Settings for Site $($Site.Name)"
 
                        Line 0 "Unable to retrieve Certificates for Site $($Site.Name)" <>                         Line 0 "Unable to retrieve Settings for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "Unable to retrieve Certificates for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "Unable to retrieve Settings for Site $($Site.Name)"
 
                No Certificates retrieved for Site $($Site.Name).` <>                 No Settings retrieved for Site $($Site.Name).`
 
                        WriteWordLine 0 0 "No Certificates retrieved for Site $($Site.Name)" <>                         WriteWordLine 0 0 "No Settings retrieved for Site $($Site.Name)"
 
                        Line 0 "No Certificates retrieved for Site $($Site.Name)" <>                         Line 0 "No Settings retrieved for Site $($Site.Name)"
 
                        WriteHTMLLine 0 0 "No Certificates retrieved for Site $($Site.Name)" <>                         WriteHTMLLine 0 0 "No Settings retrieved for Site $($Site.Name)"
 
                 <>        
            <#RASFarmSettings       
                    Dropped Properties      ExcludeDirectRDP
                                                            ExcludeDirectRDPForVDI
                                                            SendHDIcons
                                                            ReplicateSendHDIcons
                                                            EnableOverlayIcons
                                                            ShowPasswordExpiry
                                                            ReplicateURLRedirection
                                                            URLBlackList
                                                            TokenValidationTime
     
 
                 <>         #>      
 
                 <>        
            $RASClientSettings = Get-RASClientSettings -SiteId $Site.Id -EA 0 4>$Null
            
            If(!($?))
            {
                    Write-Warning "
                    `n
                    Unable to retrieve CLient Settings information
                    "
        If($MSWord -or $PDF)                   If($MSWord -or $PDF)
        {                   {
                WriteWordLine 3 0 "Client settings"                           WriteWordLine 0 0 "Unable to retrieve CLient Settings information"
                $ScriptInformation = New-Object System.Collections.ArrayList                   }
                If($FarmSettings.SendHDIcons)                   If($Text)
 
                        $ScriptInformation.Add(@{Data = "Published application icons"; Value = "Send high resolution icons (uses more network bandwidth)"; }) > $Null <>                         Line 0 "Unable to retrieve CLient Settings information"
 
                Else <>                 If($HTML)
 
                        $ScriptInformation.Add(@{Data = "Published application icons"; Value = "Send standard resolution icons"; }) > $Null <>                         WriteHTMLLine 0 0 "Unable to retrieve CLient Settings information"
 
                $ScriptInformation.Add(@{Data = "Enable overlay icon"; Value = $FarmSettings.EnableOverlayIcons.ToString(); }) > $Null +-  
                $ScriptInformation.Add(@{Data = "Show password expiration reminder"; Value = $FarmSettings.ShowPasswordExpiry.ToString(); }) > $Null    
                $ScriptInformation.Add(@{Data = "Settings are replicated to all Sites"; Value = $FarmSettings.ReplicateSendHDIcons.ToString(); }) > $Null    
     
                $Table = AddWordTable -Hashtable $ScriptInformation `    
                -Columns Data,Value `    
                -List `    
                -Format $wdTableGrid `    
                -AutoFit $wdAutoFitFixed;    
     
                SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite    
                SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;    
     
                $Table.Columns.Item(1).Width = 200;    
                $Table.Columns.Item(2).Width = 250;    
     
                $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)    
     
                FindWordDocumentEnd    
                $Table = $Null    
     
                WriteWordLine 0 0 ""    
 
        If($Text) <>         ElseIf($? -and $null -eq $RASClientSettings)
 
  <>                 Write-Host "
                Line 2 "Client settings"                   No CLient Settings information was found
                If($FarmSettings.SendHDIcons)                   " -ForegroundColor White
                    If($MSWord -or $PDF)
 
                        Line 3 "Published application icons`t`t: " "Send high resolution icons (uses more network bandwidth)" "" <>                         WriteWordLine 0 0 "No CLient Settings information was found"
 
                Else <>                 If($Text)
 
                        Line 3 "Published application icons`t`t: " "Send standard resolution icons" "" <>                         Line 0 "No CLient Settings information was found"
 
                Line 3 "Enable overlay icon`t`t`t: " $FarmSettings.EnableOverlayIcons.ToString() <>  
                Line 3 "Show password expiration reminder`t: " $FarmSettings.ShowPasswordExpiry.ToString()    
                Line 3 "Settings are replicated to all Sites`t: " $FarmSettings.ReplicateSendHDIcons.ToString()    
                Line 0 ""    
        }    
        If($HTML)                   If($HTML)
        {                   {
                WriteHTMLLine 3 0 "Client settings"                           WriteHTMLLine 0 0 "No CLient Settings information was found"
                $rowdata = @()    
                If($FarmSettings.SendHDIcons)    
                {                   }
                        $columnHeaders = @("Published application icons",($Script:htmlsb),"Send high resolution icons (uses more network bandwidth)",$htmlwhite)    
                }           }
                Else           Else
                {           {
                        $columnHeaders = @("Published application icons",($Script:htmlsb),"Send standard resolution icons",$htmlwhite)                   OutputRASClientSettings $RASClientSettings
                }    
                $rowdata += @(,("Enable overlay icon",($Script:htmlsb),$FarmSettings.EnableOverlayIcons.ToString(),$htmlwhite))    
                $rowdata += @(,("Show password expiration reminder",($Script:htmlsb),$FarmSettings.ShowPasswordExpiry.ToString(),$htmlwhite))    
                $rowdata += @(,("Settings are replicated to all Sites",($Script:htmlsb),$FarmSettings.ReplicateSendHDIcons.ToString(),$htmlwhite))    
     
                $msg = ""    
                $columnWidths = @("200","275")    
                FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths    
     
                WriteHTMLLine 0 0 ""    
 
                If($PubItem.PreferredRoutingEnabled) +-  
                {    
                        $Results = Get-RASPubItemPreferredRoute -Id $PubItem.Id -EA 0 4> $Null    
                            
                        If(!$? -or $Null -eq $Results)    
                        {    
                                $PreferredRouting = ""    
                        }    
                        Else    
                        {    
                                $PreferredRouting = ""    
                        }    
                }    
                Else    
                {    
                        $PreRouting = ""    
                }    
                    
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.WebPortal) <>                                         If($PubItem.AllowedOSes.WebClient)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
  -+                                 If($PubItem.PreferredRoutingEnabled)
                                    {
                                            $Results = Get-RASPubItemPreferredRoute -Id $PubItem.Id -EA 0 4> $Null
                                            
                                            If($? -and $Null -ne $Results)
                                            {
                                                    $cnt =-1
                                                    ForEach($PrefRoute in $Results)
                                                    {
                                                            $CustomRoute = Get-RASCustomRoute -Id $PrefRoute.Id -EA 0 4>$Null
                                                            
                                                            If($? -and $Null -ne $CustomRoute)
                                                            {
                                                                    $cnt++
                                                                    If($cnt -eq 0)
                                                                    {
                                                                            $ScriptInformation.Add(@{Data = "Preferred routing is enabled"; Value = ""; }) > $Null
                                                                            $ScriptInformation.Add(@{Data = ""; Value = "$($CustomRoute.Name), custom route on IP $($CustomRoute.PublicAddress)"; }) > $Null
                                                                    }
                                                                    Else
                                                                    {
                                                                            $ScriptInformation.Add(@{Data = ""; Value = "$($CustomRoute.Name), custom route on IP $($CustomRoute.PublicAddress)"; }) > $Null
                                                                    }
                                                            }
                                                    }
                                            }
                                    }
                    
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
  -+                                         }
                                    }
     
                                    If($PubItem.PreferredRoutingEnabled)
                                    {
                                            $Results = Get-RASPubItemPreferredRoute -Id $PubItem.Id -EA 0 4> $Null
                                            
                                            If($? -and $Null -ne $Results)
                                            {
                                                    $cnt =-1
                                                    ForEach($PrefRoute in $Results)
                                                    {
                                                            $CustomRoute = Get-RASCustomRoute -Id $PrefRoute.Id -EA 0 4>$Null
                                                            
                                                            If($? -and $Null -ne $CustomRoute)
                                                            {
                                                                    $cnt++
                                                                    If($cnt -eq 0)
                                                                    {
                                                                            Line 3 "Preferred routing is enabled"
                                                                            Line 7 "$($CustomRoute.Name), custom route on IP $($CustomRoute.PublicAddress)"
                                                                    }
                                                                    Else
                                                                    {
                                                                            Line 7 "$($CustomRoute.Name), custom route on IP $($CustomRoute.PublicAddress)"
                                                                    }
                                                            }
                                                    }
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
  -+                                 If($PubItem.PreferredRoutingEnabled)
                                    {
                                            $Results = Get-RASPubItemPreferredRoute -Id $PubItem.Id -EA 0 4> $Null
                                            
                                            If($? -and $Null -ne $Results)
                                            {
                                                    $cnt =-1
                                                    ForEach($PrefRoute in $Results)
                                                    {
                                                            $CustomRoute = Get-RASCustomRoute -Id $PrefRoute.Id -EA 0 4>$Null
                                                            
                                                            If($? -and $Null -ne $CustomRoute)
                                                            {
                                                                    $cnt++
                                                                    If($cnt -eq 0)
                                                                    {
                                                                            $rowdata += @(,("Preferred routing is enabled",($Script:htmlsb),"",$htmlwhite))
                                                                            $rowdata += @(,("",($Script:htmlsb),"$($CustomRoute.Name), custom route on IP $($CustomRoute.PublicAddress)",$htmlwhite))
                                                                    }
                                                                    Else
                                                                    {
                                                                            $rowdata += @(,("",($Script:htmlsb),"$($CustomRoute.Name), custom route on IP $($CustomRoute.PublicAddress)",$htmlwhite))
                                                                    }
                                                            }
                                                    }
                                            }
                                    }
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "ChromeApp"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "Chrome OS"; }) > $Null
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $ScriptInformation.Add(@{Data = ""; Value = "HTML5"; }) > $Null    
                                        }    
                                            
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "iOS"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "iOS/iPadOS"; }) > $Null
 
                                                $ScriptInformation.Add(@{Data = ""; Value = "RAS Web Portal"; }) > $Null <>                                                 $ScriptInformation.Add(@{Data = ""; Value = "User Portal (Web Client)"; }) > $Null
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                Line 10 "  ChromeApp" <>                                                 Line 10 "  Chrome OS"
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                Line 10 "  HTML5"    
                                        }    
                                            
 
                                                Line 10 "  iOS" <>                                                 Line 10 "  iOS/iPadOS"
 
                                   $PubItem.GWFilterEnabled -or  <>                                    $PubItem.GatewayFilterEnabled -or 
 
                                If($PubItem.GWFilterEnabled) <>                                 If($PubItem.GatewayFilterEnabled)
 
                                        ForEach($item in $PubItem.AllowedGWs) <>                                         ForEach($item in $PubItem.AllowedGateways)
 
                                                $rowdata += @(,("",($Script:htmlsb),"ChromeApp",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"Chrome OS",$htmlwhite))
 
                                        If($PubItem.AllowedOSes.HTML5) +-  
                                        {    
                                                $rowdata += @(,("",($Script:htmlsb),"HTML5",$htmlwhite))    
                                        }    
                                            
 
                                                $rowdata += @(,("",($Script:htmlsb),"iOS",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"iOS/iPadOS",$htmlwhite))
 
                                                $rowdata += @(,("",($Script:htmlsb),"RAS Web Portal",$htmlwhite)) <>                                                 $rowdata += @(,("",($Script:htmlsb),"User Portal (Web Client)",$htmlwhite))
 
  <>                         If(validObject $PubItem UserFilterReplicate)
                            {
                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                        $ScriptInformation.Add(@{Data = "Settings are replicated to all Sites"; Value = $PubItem.UserFilterReplicate.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "Settings are replicated to all Sites"; Value = $PubItem.UserFilterReplicate.ToString(); }) > $Null
 
                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                        -Columns Data,Value `                                   -Columns Data,Value `
                        -List `                                   -List `
                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                        $Table.Columns.Item(1).Width = 200; <>                                 $Table.Columns.Item(1).Width = 200;
                        $Table.Columns.Item(2).Width = 100;                                   $Table.Columns.Item(2).Width = 100;
 
                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                        $Table = $Null                                   $Table = $Null
                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
                            }
 
                                $ScriptInformation.Add(@{Data = "ChromeApp"; Value = "Enabled"; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Chrome OS"; Value = "Enabled"; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "ChromeApp"; Value = "Disabled"; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Chrome OS"; Value = "Disabled"; }) > $Null
 
                        If($PubItem.AllowedOSes.HTML5) +-  
                        {    
                                $ScriptInformation.Add(@{Data = "HTML5"; Value = "Enabled"; }) > $Null    
                        }    
                        Else    
                        {    
                                $ScriptInformation.Add(@{Data = "HTML5"; Value = "Disabled"; }) > $Null    
                        }    
                            
 
                                $ScriptInformation.Add(@{Data = "iOS"; Value = "Enabled"; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "iOS/iPadOS"; Value = "Enabled"; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "iOS"; Value = "Disabled"; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "iOS/iPadOS"; Value = "Disabled"; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "RAS Web Portal"; Value = "Enabled"; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "User Portal (Web Client)"; Value = "Enabled"; }) > $Null
 
                                $ScriptInformation.Add(@{Data = "RAS Web Portal"; Value = "Disabled"; }) > $Null <>                                 $ScriptInformation.Add(@{Data = "User Portal (Web Client)"; Value = "Disabled"; }) > $Null
 
                If(!($PubItem.GWFilterEnabled)) <>                 If(!($PubItem.GatewayFilterEnabled))
 
                        ForEach($item in $PubItem.AllowedGWs) <>                         ForEach($item in $PubItem.AllowedGateways)
 
  <>                         If(validObject $PubItem UserFilterReplicate)
                            {
                        Line 3 "Settings are replicated to all Sites: " $PubItem.UserFilterReplicate.ToString()                                   Line 3 "Settings are replicated to all Sites: " $PubItem.UserFilterReplicate.ToString()
                        Line 0 ""                                   Line 0 ""
                            }
 
                                Line 3 "ChromeApp`t: " "Enabled" <>                                 Line 3 "Chrome OS`t: " "Enabled"
 
                                Line 3 "ChromeApp`t: " "Disabled" <>                                 Line 3 "Chrome OS`t: " "Disabled"
                        }    
                            
                        If($PubItem.AllowedOSes.HTML5)    
                        {    
                                Line 3 "HTML5`t`t: " "Enabled"    
                        }    
                        Else    
                        {    
                                Line 3 "HTML5`t`t: " "Disabled"    
 
                If(!($PubItem.GWFilterEnabled)) <>                 If(!($PubItem.GatewayFilterEnabled))
 
                        ForEach($item in $PubItem.AllowedGWs) <>                         ForEach($item in $PubItem.AllowedGateways)
 
  <>                         If(validObject $PubItem UserFilterReplicate)
                            {
                        $rowdata = @()                                   $rowdata = @()
                        $columnHeaders = @("Settings are replicated to all Sites",($Script:htmlsb),$PubItem.UserFilterReplicate.ToString(),$htmlwhite)                                   $columnHeaders = @("Settings are replicated to all Sites",($Script:htmlsb),$PubItem.UserFilterReplicate.ToString(),$htmlwhite)
 
                        $msg = "" <>                                 $msg = ""
                        $columnWidths = @("183","100")                                   $columnWidths = @("183","100")
                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                            }
 
                                $rowdata += @(,("ChromeApp",($Script:htmlsb),"Enabled",$htmlwhite)) <>                                 $rowdata += @(,("Chrome OS",($Script:htmlsb),"Enabled",$htmlwhite))
 
                                $rowdata += @(,("ChromeApp",($Script:htmlsb),"Disabled",$htmlwhite)) <>                                 $rowdata += @(,("Chrome OS",($Script:htmlsb),"Disabled",$htmlwhite))
 
                        If($PubItem.AllowedOSes.HTML5) +-  
                        {    
                                $rowdata += @(,("HTML5",($Script:htmlsb),"Enabled",$htmlwhite))    
                        }    
                        Else    
                        {    
                                $rowdata += @(,("HTML5",($Script:htmlsb),"Disabled",$htmlwhite))    
                        }    
                            
 
                                $rowdata += @(,("iOS",($Script:htmlsb),"Enabled",$htmlwhite)) <>                                 $rowdata += @(,("iOS/iPadOS",($Script:htmlsb),"Enabled",$htmlwhite))
 
                                $rowdata += @(,("iOS",($Script:htmlsb),"Disabled",$htmlwhite)) <>                                 $rowdata += @(,("iOS/iPadOS",($Script:htmlsb),"Disabled",$htmlwhite))
 
                                $rowdata += @(,("RAS Web Portal",($Script:htmlsb),"Enabled",$htmlwhite)) <>                                 $rowdata += @(,("User Portal (Web Client)",($Script:htmlsb),"Enabled",$htmlwhite))
 
                                $rowdata += @(,("RAS Web Portal",($Script:htmlsb),"Disabled",$htmlwhite)) <>                                 $rowdata += @(,("User Portal (Web Client)",($Script:htmlsb),"Disabled",$htmlwhite))
 
                If(!($PubItem.GWFilterEnabled)) <>                 If(!($PubItem.GatewayFilterEnabled))
 
                        ForEach($item in $PubItem.AllowedGWs) <>                         ForEach($item in $PubItem.AllowedGateways)
 
  -+                         If(validObject $results EnablePrinting)
                            {
                                    $PrintingState = $Results.EnablePrinting
                            }
                            Else
                            {
                                    $PrintingState = ""
                            }
                            
 
                                PrintingState = $Results.EnablePrinting <>                                 PrintingState = $PrintingState
 
  -+                         If(validObject $results EnablePrinting)
                            {
                                    $PrintingState = $Results.EnablePrinting
                            }
                            Else
                            {
                                    $PrintingState = ""
                            }
                            
 
                                PrintingState = $Results.EnablePrinting <>                                 PrintingState = $PrintingState
 
  <>         If(validObject $RDSObj Type)
            {
        $RDSType = $RDSObj.Type                   $RDSType = $RDSObj.Type
            }
            Else
            {
                    $RDSType = ""
            }
     
            If(validObject $VDIHostsObj Type)
            {
        $VDIType = $VDIHostsObj.Type                   $VDIType = $VDIHostsObj.Type
            }
            Else
            {
                    $VDIType = ""
            }
 
  <>                 If(validObject $VDIHostsObj Server)
                    {
                ForEach($VDIServer in $VDIHostsobj.Server)                           ForEach($VDIServer in $VDIHostsobj.Server)
                {                           {
                        $ServersInSiteTable += @{                                   $ServersInSiteTable += @{
                                Server = $VDIServer                                           Server = $VDIServer
                                Type   = $VDIType                                           Type   = $VDIType
                                State  = $VDIHostsPrintingState                                           State  = $VDIHostsPrintingState
                                    }
 
                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite +-  
 
  -+                         If(validObject $Results EnableWIA)
                            {
                                    $WIAState = $Results.EnableWIA
                            }
                            Else
                            {
                                    $WIAState = $False
                            }
                            
                            If(validObject $Results EnableTWAIN)
                            {
                                    $TWAINState = $Results.EnableTWAIN
                            }
                            Else
                            {
                                    $TWAINState = $False
                            }
                            
 
                                WIAState = $Results.EnableWIA <>                                 WIAState = $WIAState
                                TWAINState = $Results.EnableTWAIN                                   TWAINState = $TWAINState
 
  -+                         If(validObject $Results EnableWIA)
                            {
                                    $WIAState = $Results.EnableWIA
                            }
                            Else
                            {
                                    $WIAState = $False
                            }
                            
                            If(validObject $Results EnableTWAIN)
                            {
                                    $TWAINState = $Results.EnableTWAIN
                            }
                            Else
                            {
                                    $TWAINState = $False
                            }
                            
 
                                WIAState = $Results.EnableWIA <>                                 WIAState = $WIAState
                                TWAINState = $Results.EnableTWAIN                                   TWAINState = $TWAINState
 
  <>                 If(validObject $RDSobj Server)
                    {
                $cnt = -1                           $cnt = -1
                ForEach($RDSServer in $RDSobj.Server)                           ForEach($RDSServer in $RDSobj.Server)
                {                           {
                        $cnt++                                   $cnt++
                        $ServersInSiteTable += @{                                   $ServersInSiteTable += @{
                                Server = $RDSServer                                           Server = $RDSServer
                                Type   = $RDSType                                           Type   = $RDSType
                                State  = $RDSobj.WIAState[$cnt].ToString()                                           State  = $RDSobj.WIAState[$cnt].ToString()
                        }                                   }
                }                           }
                    }
 
  <>                 If(validObject $VDIHostsobj Server)
                    {
                $cnt = -1                           $cnt = -1
                ForEach($VDIServer in $VDIHostsobj.Server)                           ForEach($VDIServer in $VDIHostsobj.Server)
                {                           {
                        $cnt++                                   $cnt++
                        $ServersInSiteTable += @{                                   $ServersInSiteTable += @{
                                Server = $VDIServer                                           Server = $VDIServer
                                Type   = $VDIType                                           Type   = $VDIType
                                State  = $VDIHostsobj.WIAState[$cnt].ToString()                                           State  = $VDIHostsobj.WIAState[$cnt].ToString()
                                    }
 
  <>                 If(validObject $RDSobj Server)
                    {
                $cnt = -1                           $cnt = -1
                ForEach($RDSServer in $RDSobj.Server)                           ForEach($RDSServer in $RDSobj.Server)
                {                           {
                        $cnt++                                   $cnt++
                        Line 3 ( "{0,-30} {1,-20} {2,-8}" -f                                    Line 3 ( "{0,-30} {1,-20} {2,-8}" -f 
                                $RDSServer,                                            $RDSServer, 
                                $RDSType,                                            $RDSType, 
                                $RDSobj.WIAState[$cnt].ToString()                                           $RDSobj.WIAState[$cnt].ToString()
                        )                                   )
                }                           }
                    }
 
  <>                 If(validObject $VDIHostsobj Server)
                    {
                $cnt = -1                           $cnt = -1
                ForEach($VDIServer in $VDIHostsobj.Server)                           ForEach($VDIServer in $VDIHostsobj.Server)
                {                           {
                        $cnt++                                   $cnt++
                        Line 3 ( "{0,-30} {1,-20} {2,-8}" -f                                    Line 3 ( "{0,-30} {1,-20} {2,-8}" -f 
                                $VDIServer,                                            $VDIServer, 
                                $VDIType,                                            $VDIType, 
                                $VDIHostsobj.WIAState[$cnt].ToString()                                           $VDIHostsobj.WIAState[$cnt].ToString()
                        )                                   )
                }                           }
                    }
 
  <>                 If(validObject $RDSobj Server)
                    {
                $cnt = -1                           $cnt = -1
                ForEach($RDSServer in $RDSobj.Server)                           ForEach($RDSServer in $RDSobj.Server)
                {                           {
                        $cnt++                                   $cnt++
                        $rowdata += @(,(                                   $rowdata += @(,(
                                $RDSServer,$htmlwhite,                                           $RDSServer,$htmlwhite,
                                $RDSType,$htmlwhite,                                           $RDSType,$htmlwhite,
                                $RDSobj.WIAState[$cnt].ToString(),$htmlwhite)                                           $RDSobj.WIAState[$cnt].ToString(),$htmlwhite)
                        )                                   )
                }                           }
                    }
 
  <>                 If(validObject $VDIHostsobj Server)
                    {
                $cnt = -1                           $cnt = -1
                ForEach($VDIServer in $VDIHostsobj.Server)                           ForEach($VDIServer in $VDIHostsobj.Server)
                {                           {
                        $cnt++                                   $cnt++
                        $rowdata += @(,(                                   $rowdata += @(,(
                                $VDIServer,$htmlwhite,                                           $VDIServer,$htmlwhite,
                                $VDIType,$htmlwhite,                                           $VDIType,$htmlwhite,
                                $VDIHostsobj.WIAState[$cnt].ToString(),$htmlwhite)                                           $VDIHostsobj.WIAState[$cnt].ToString(),$htmlwhite)
                        )                                   )
                            }
 
        Write-Verbose "$(Get-Date -Format G): `tProcessing Second level authentication" <>         Write-Verbose "$(Get-Date -Format G): `tProcessing Multi-Factor authentication"
 
        $results = Get-RAS2FASetting -SiteId $Site.Id -EA 0 4>$Null <>         $MFA = Get-RASMFA -SiteId $Site.Id -EA 0 4>$Null
 
                Unable to retrieve Second level authentication information <>                 Unable to retrieve Multi-Factor authentication information
 
                        WriteWordLine 0 0 "Unable to retrieve Second level authentication information" <>                         WriteWordLine 0 0 "Unable to retrieve Multi-Factor authentication information"
 
                        Line 0 "Unable to retrieve Second level authentication information" <>                         Line 0 "Unable to retrieve Multi-Factor authentication information"
 
                        WriteHTMLLine 0 0 "Unable to retrieve Second level authentication information" <>                         WriteHTMLLine 0 0 "Unable to retrieve Multi-Factor authentication information"
 
        ElseIf($? -and $null -eq $results) <>         ElseIf($? -and $null -eq $MFA)
 
                No Second level authentication information was found <>                 No Multi-Factor authentication information was found
 
                        WriteWordLine 0 0 "No Second level authentication information was found" <>                         WriteWordLine 0 0 "No Multi-Factor authentication information was found"
 
                        Line 0 "No Second level authentication information was found" <>                         Line 0 "No Multi-Factor authentication information was found"
 
                        WriteHTMLLine 0 0 "No Second level authentication information was found" <>                         WriteHTMLLine 0 0 "No Multi-Factor authentication information was found"
 
                Output2FASetting $results <>                 OutputMFASetting $MFA
 
  <>         
 
Function Output2FASetting <> Function OutputMFASetting
 
        Param([object] $RAS2FASettings) <>         Param([object] $RASMFASettings)
 
        Write-Verbose "$(Get-Date -Format G): `t`tOutput Second level authentication" <>         Write-Verbose "$(Get-Date -Format G): `t`tOutput Multi-Factor authentication"
 
                WriteWordLine 2 0 "Multi-factor authentication" <>                 WriteWordLine 2 0 "Multi-Factor authentication"
 
                Line 1 "Multi-factor authentication" <>                 Line 1 "Multi-Factor authentication"
 
                WriteHTMLLine 2 0 "Multi-factor authentication" <>                 WriteHTMLLine 2 0 "Multi-Factor authentication"
 
  <>         ForEach($RASMFASetting in $RASMFASettings)
            {
        Switch ($RAS2FASettings.Provider)                   Switch ($RASMFASetting.Type)
        {                   {
                "None"                  {$RAS2FASettingsProvider = "None"; Break}                           "None"                  {$RASMFASettingProvider = "None"; Break}
                "Deepnet"               {$RAS2FASettingsProvider = "Deepnet"; Break}                           "Deepnet"               {$RASMFASettingProvider = "Deepnet"; Break}
                "SafeNet"               {$RAS2FASettingsProvider = "SafeNet"; Break}                           "SafeNet"               {$RASMFASettingProvider = "SafeNet"; Break}
                "Radius"                {$RAS2FASettingsProvider = "RADIUS"; Break}                           "Radius"                {$RASMFASettingProvider = "RADIUS"; Break}
                "AzureRadius"   {$RAS2FASettingsProvider = "Azure MFA server (RADIUS)"; Break}                           "AzureRadius"   {$RASMFASettingProvider = "Azure MFA server (RADIUS)"; Break}
                "DuoRadius"     {$RAS2FASettingsProvider = "Duo (RADIUS)"; Break}                           "DuoRadius"     {$RASMFASettingProvider = "Duo (RADIUS)"; Break}
                "FortiRadius"   {$RAS2FASettingsProvider = "FortiAuthenticator (RADIUS)"; Break}                           "FortiRadius"   {$RASMFASettingProvider = "FortiAuthenticator (RADIUS)"; Break}
                "TekRadius"     {$RAS2FASettingsProvider = "TekRADIUS"; Break}                           "TekRadius"     {$RASMFASettingProvider = "TekRADIUS"; Break}
                "GAuthTOTP"             {$RAS2FASettingsProvider = "Google Authenticator"; Break}                           "GAuthTOTP"             {$RASMFASettingProvider = "Google Authenticator"; Break}
                Default                 {$RAS2FASettingsProvider = "Unable to determine 2FA Provider: $($RAS2FASettings.Provider)"; Break}                           Default                 {$RASMFASettingProvider = "Unable to determine MFA Provider: $($RASMFASetting.Type)"; Break}
        }                   }
 
        If($MSWord -or $PDF) <>                 If($MSWord -or $PDF)
        {                   {
                WriteWordLine 3 0 "Provider settings"                           WriteWordLine 3 0 "Provider settings"
                $ScriptInformation = New-Object System.Collections.ArrayList                           $ScriptInformation = New-Object System.Collections.ArrayList
                $ScriptInformation.Add(@{Data = "Provider"; Value = $RAS2FASettingsProvider; }) > $Null                           $ScriptInformation.Add(@{Data = "Provider"; Value = $RASMFASettingProvider; }) > $Null
                                          
                If($RAS2FASettingsProvider -ne "None")                           If($RASMFASettingProvider -ne "None")
                {                           {
                        $ScriptInformation.Add(@{Data = "Settings"; Value = ""; }) > $Null                                   $ScriptInformation.Add(@{Data = "Settings"; Value = ""; }) > $Null
                                                          
                        If($RAS2FASettings.Provider -eq "AzureRadius")                                   If($RASMFASetting.Type -eq "AzureRadius")
                        {                                   {
                                            $ScriptInformation.Add(@{Data = "     General"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Enable MFA provider in site"; Value = $RASMFASetting.Enabled.ToString(); }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Name"; Value = $RASMFASetting.Name; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Description"; Value = $RASMFASetting.Description; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Type"; Value = $RASMFASetting.DisplayName; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Connection"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Connection"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RAS2FASettings.AzureRadiusSettings.TypeName; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Display Name"; Value = $RASMFASetting.DisplayName; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RAS2FASettings.AzureRadiusSettings.Server; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RASMFASetting.Server; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RAS2FASettings.AzureRadiusSettings.BackupServer; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RASMFASetting.BackupServer; }) > $Null
                                If($RAS2FASettings.AzureRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null
                                            }
                                            $ScriptInformation.Add(@{Data = "          Port"; Value = $RASMFASetting.Port; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Timeout (seconds)"; Value = $RASMFASetting.Timeout; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Retries"; Value = $RASMFASetting.Retries; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RASMFASetting.PasswordEncoding; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RASMFASetting.UsernameOnly.ToString(); }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RASMFASetting.ForwardFirstPwdToAD.ToString(); }) > $Null
                                            $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null
                                            $cnt=0
                                            ForEach($Item in $RASMFASetting.AttributeInfoList)
                                            {
                                                    $cnt++
                                                    $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.RadiusAttrName)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.VendorID)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                            }
                                            $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null
                                            $cnt=0
                                            ForEach($Item in $RASMFASetting.AutomationInfoList)
                                            {
                                                    $cnt++
                                                    $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Enable Action: $($Item.Enabled.ToString())"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Description: $($Item.Description)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Action message: $($Item.ActionMessage)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null
                                                    $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                            }
 
  <>                                 ElseIf($RASMFASetting.Type -eq "DuoRadius")
                                    {
                                            $ScriptInformation.Add(@{Data = "          Type"; Value = $RASMFASetting.DisplayName; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Primary Server"; Value = $RASMFASetting.Server; }) > $Null
                                            $ScriptInformation.Add(@{Data = "          Secondary Server"; Value = $RASMFASetting.BackupServer; }) > $Null
                                            If($RASMFASetting.HAMode -eq "Parallel")
                                            {
                                                    $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null
                                            }
                                            Else
                                            {
                                                    $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null
                                            }
                                $ScriptInformation.Add(@{Data = "          Port"; Value = $RAS2FASettings.AzureRadiusSettings.Port; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Port"; Value = $RASMFASetting.Port; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RAS2FASettings.AzureRadiusSettings.Timeout; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RASMFASetting.Timeout; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Retries"; Value = $RAS2FASettings.AzureRadiusSettings.Retries; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Retries"; Value = $RASMFASetting.Retries; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RAS2FASettings.AzureRadiusSettings.PasswordEncoding; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RASMFASetting.PasswordEncoding; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RAS2FASettings.AzureRadiusSettings.UsernameOnly.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RASMFASetting.UsernameOnly.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RAS2FASettings.AzureRadiusSettings.ForwardFirstPwdToAD.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RASMFASetting.ForwardFirstPwdToAD.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.AzureRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                                $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.AzureRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "DuoRadius")                                   ElseIf($RASMFASetting.Type -eq "FortiRadius")
                        {                                   {
                                $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RAS2FASettings.DuoRadiusSettings.TypeName; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RASMFASetting.DisplayName; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Primary Server"; Value = $RAS2FASettings.DuoRadiusSettings.Server; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RASMFASetting.Server; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Secondary Server"; Value = $RAS2FASettings.DuoRadiusSettings.BackupServer; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RASMFASetting.BackupServer; }) > $Null
                                If($RAS2FASettings.DuoRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null
                                }                                           }
                                $ScriptInformation.Add(@{Data = "          Port"; Value = $RAS2FASettings.DuoRadiusSettings.Port; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Port"; Value = $RASMFASetting.Port; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RAS2FASettings.DuoRadiusSettings.Timeout; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RASMFASetting.Timeout; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Retries"; Value = $RAS2FASettings.DuoRadiusSettings.Retries; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Retries"; Value = $RASMFASetting.Retries; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RAS2FASettings.DuoRadiusSettings.PasswordEncoding; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RASMFASetting.PasswordEncoding; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RAS2FASettings.DuoRadiusSettings.UsernameOnly.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RASMFASetting.UsernameOnly.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RAS2FASettings.DuoRadiusSettings.ForwardFirstPwdToAD.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RASMFASetting.ForwardFirstPwdToAD.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.DuoRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                                $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.DuoRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "FortiRadius")                                   ElseIf($RASMFASetting.Type -eq "TekRadius")
                        {                                   {
                                $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RAS2FASettings.FortiRadiusSettings.TypeName; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RASMFASetting.DisplayName; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RAS2FASettings.FortiRadiusSettings.Server; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RASMFASetting.Server; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RAS2FASettings.FortiRadiusSettings.BackupServer; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RASMFASetting.BackupServer; }) > $Null
                                If($RAS2FASettings.FortiRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null
                                }                                           }
                                $ScriptInformation.Add(@{Data = "          Port"; Value = $RAS2FASettings.FortiRadiusSettings.Port; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Port"; Value = $RASMFASetting.Port; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RAS2FASettings.FortiRadiusSettings.Timeout; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RASMFASetting.Timeout; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Retries"; Value = $RAS2FASettings.FortiRadiusSettings.Retries; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Retries"; Value = $RASMFASetting.Retries; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RAS2FASettings.FortiRadiusSettings.PasswordEncoding; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RASMFASetting.PasswordEncoding; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RAS2FASettings.FortiRadiusSettings.UsernameOnly.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RASMFASetting.UsernameOnly.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RAS2FASettings.FortiRadiusSettings.ForwardFirstPwdToAD.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RASMFASetting.ForwardFirstPwdToAD.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.FortiRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                                $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.FortiRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "TekRadius")                                   ElseIf($RASMFASetting.Type -eq "Radius")
                        {                                   {
                                $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RAS2FASettings.TekRadiusSettings.TypeName; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RASMFASetting.DisplayName; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RAS2FASettings.TekRadiusSettings.Server; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RASMFASetting.Server; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RAS2FASettings.TekRadiusSettings.BackupServer; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RASMFASetting.BackupServer; }) > $Null
                                If($RAS2FASettings.TekRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null
                                }                                           }
                                $ScriptInformation.Add(@{Data = "          Port"; Value = $RAS2FASettings.TekRadiusSettings.Port; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Port"; Value = $RASMFASetting.Port; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RAS2FASettings.TekRadiusSettings.Timeout; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RASMFASetting.Timeout; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Retries"; Value = $RAS2FASettings.TekRadiusSettings.Retries; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Retries"; Value = $RASMFASetting.Retries; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RAS2FASettings.TekRadiusSettings.PasswordEncoding; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RASMFASetting.PasswordEncoding; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RAS2FASettings.TekRadiusSettings.UsernameOnly.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RASMFASetting.UsernameOnly.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RAS2FASettings.TekRadiusSettings.ForwardFirstPwdToAD.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RASMFASetting.ForwardFirstPwdToAD.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null
                                            $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.TekRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                                $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.TekRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line                                                   $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "Radius")    
                        {    
                                $ScriptInformation.Add(@{Data = "          Type Name"; Value = $RAS2FASettings.RadiusSettings.TypeName; }) > $Null    
                                $ScriptInformation.Add(@{Data = "          Primary server"; Value = $RAS2FASettings.RadiusSettings.Server; }) > $Null    
                                $ScriptInformation.Add(@{Data = "          Secondary server"; Value = $RAS2FASettings.RadiusSettings.BackupServer; }) > $Null    
                                If($RAS2FASettings.RadiusSettings.HAMode -eq "Parallel")    
                                {    
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - active (parallel)"; }) > $Null    
                                }    
                                Else    
                                {    
                                        $ScriptInformation.Add(@{Data = "          HA mode"; Value = "Active - passive (failover)"; }) > $Null    
                                }    
                                $ScriptInformation.Add(@{Data = "          Port"; Value = $RAS2FASettings.RadiusSettings.Port; }) > $Null    
                                $ScriptInformation.Add(@{Data = "          Timeout"; Value = $RAS2FASettings.RadiusSettings.Timeout; }) > $Null    
                                $ScriptInformation.Add(@{Data = "          Retries"; Value = $RAS2FASettings.RadiusSettings.Retries; }) > $Null    
                                $ScriptInformation.Add(@{Data = "          Password Encoding"; Value = $RAS2FASettings.RadiusSettings.PasswordEncoding; }) > $Null    
                                $ScriptInformation.Add(@{Data = "          Forward username only to Radius Server"; Value = $RAS2FASettings.RadiusSettings.UsernameOnly.ToString(); }) > $Null    
                                $ScriptInformation.Add(@{Data = "          Forward the first password to Windows authentication provider"; Value = $RAS2FASettings.RadiusSettings.ForwardFirstPwdToAD.ToString(); }) > $Null    
                                $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null    
                                $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null    
                                $ScriptInformation.Add(@{Data = "     Attributes"; Value = ""; }) > $Null    
                                $cnt=0    
                                ForEach($Item in $RAS2FASettings.RadiusSettings.AttributeInfoList)    
                                {    
                                        $cnt++    
                                        $ScriptInformation.Add(@{Data = ""; Value = "Attribute $cnt"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Name: $($Item.Name)"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Vendor: $($Item.Vendor)"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Type: $($Item.AttributeType)"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Value: $($Item.Value)"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line    
                                }    
                                $ScriptInformation.Add(@{Data = "     Automation"; Value = ""; }) > $Null    
                                $cnt=0    
                                ForEach($Item in $RAS2FASettings.RadiusSettings.AutomationInfoList)    
                                {    
                                        $cnt++    
                                        $ScriptInformation.Add(@{Data = ""; Value = "Automation $cnt"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Enabled: $($Item.Enabled.ToString())"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Title: $($Item.Title)"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Command: $($Item.Command)"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Image: $($Item.Image)"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = "     Autosend: $($Item.AutoSend.ToString())"; }) > $Null    
                                        $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null #blank separator line    
                                }    
                        }    
                        ElseIf($RAS2FASettings.Provider -eq "Deepnet")                                   ElseIf($RASMFASetting.Type -eq "Deepnet")
                        {                                   {
                                Switch($RAS2FASettings.DeepnetSettings.AuthMode)                                           Switch($RASMFASetting.AuthMode)
                                {                                           {
                                        "MandatoryForAllUsers"                                          {$DeepNetAuthMode = "Mandatory for all users"; Break}                                                   "MandatoryForAllUsers"                                          {$DeepNetAuthMode = "Mandatory for all users"; Break}
                                        "CreateTokenForDomainAuthenticatedUsers"        {$DeepNetAuthMode = "Create token for Domain Authenticated users"; Break}                                                   "CreateTokenForDomainAuthenticatedUsers"        {$DeepNetAuthMode = "Create token for Domain Authenticated users"; Break}
                                        "UsersWithSafeNetAcc"                                           {$DeepNetAuthMode = "Use only for users with a safe account"; Break}                                                   "UsersWithSafeNetAcc"                                           {$DeepNetAuthMode = "Use only for users with a safe account"; Break}
                                        Default                                                                         {$DeepNetAuthMode = "Deepnet mode not found: $($RAS2FASettings.DeepnetSettings.AuthMode)"; Break}                                                   Default                                                                         {$DeepNetAuthMode = "Deepnet mode not found: $($RASMFASetting.AuthMode)"; Break}
                                }                                           }
                                                                          
                                $ScriptInformation.Add(@{Data = "     Connection"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Connection"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Type"; Value = $RAS2FASettings.DeepnetSettings.DeepnetType; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Type"; Value = $RASMFASetting.DeepnetType; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Server"; Value = $RAS2FASettings.DeepnetSettings.Server; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Server"; Value = $RASMFASetting.Server; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Port"; Value = $RAS2FASettings.DeepnetSettings.Port.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Port"; Value = $RASMFASetting.Port.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "          Enable SSL"; Value = $RAS2FASettings.DeepnetSettings.SSL.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Enable SSL"; Value = $RASMFASetting.SSL.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "          Agent"; Value = $RAS2FASettings.DeepnetSettings.DeepnetAgent; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Agent"; Value = $RASMFASetting.DeepnetAgent; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Application"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Application"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Application"; Value = $RAS2FASettings.DeepnetSettings.App; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Application"; Value = $RASMFASetting.App; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Domain"; Value = $RAS2FASettings.DeepnetSettings.DefaultDomain; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Domain"; Value = $RASMFASetting.DefaultDomain; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Authentication"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Authentication"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Mode"; Value = $DeepNetAuthMode; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Mode"; Value = $DeepNetAuthMode; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Token Type"; Value = $RAS2FASettings.DeepnetSettings.TokenType.ToString(); }) > $Null                                           $ScriptInformation.Add(@{Data = "          Token Type"; Value = $RASMFASetting.TokenType.ToString(); }) > $Null
                                $ScriptInformation.Add(@{Data = "          Allow Channels"; Value = "Email: $($RAS2FASettings.DeepnetSettings.ActivateEmail.ToString())"; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Allow Channels"; Value = "Email: $($RASMFASetting.ActivateEmail.ToString())"; }) > $Null
                                $ScriptInformation.Add(@{Data = "                        "; Value = "SMS: $($RAS2FASettings.DeepnetSettings.ActivateSMS.ToString())"; }) > $Null                                           $ScriptInformation.Add(@{Data = "                        "; Value = "SMS: $($RASMFASetting.ActivateSMS.ToString())"; }) > $Null
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "SafeNet")                                   ElseIf($RASMFASetting.Type -eq "SafeNet")
                        {                                   {
                                Switch($RAS2FASettings.SafeNetSettings.AuthMode)                                           Switch($RASMFASetting.AuthMode)
                                {                                           {
                                        "MandatoryForAllUsers"                                          {$SafeNetAuthMode = "Mandatory for all users"; Break}                                                   "MandatoryForAllUsers"                                          {$SafeNetAuthMode = "Mandatory for all users"; Break}
                                        "CreateTokenForDomainAuthenticatedUsers"        {$SafeNetAuthMode = "Create token for Domain Authenticated users"; Break}                                                   "CreateTokenForDomainAuthenticatedUsers"        {$SafeNetAuthMode = "Create token for Domain Authenticated users"; Break}
                                        "UsersWithSafeNetAcc"                                           {$SafeNetAuthMode = "Use only for users with a safe account"; Break}                                                   "UsersWithSafeNetAcc"                                           {$SafeNetAuthMode = "Use only for users with a safe account"; Break}
                                        Default                                                                         {$SafeNetAuthMode = "Safenet mode not found: $($RAS2FASettings.SafeNetSettings.AuthMode)"; Break}                                                   Default                                                                         {$SafeNetAuthMode = "Safenet mode not found: $($RASMFASetting.AuthMode)"; Break}
                                }                                           }
 
                                $ScriptInformation.Add(@{Data = "     Connection"; Value = ""; }) > $Null <>                                         $ScriptInformation.Add(@{Data = "     Connection"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "          OTP Service URL"; Value = $RAS2FASettings.SafeNetSettings.OTPServiceURL; }) > $Null                                           $ScriptInformation.Add(@{Data = "          OTP Service URL"; Value = $RASMFASetting.OTPServiceURL; }) > $Null
                                $ScriptInformation.Add(@{Data = "     Authentication"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Authentication"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "          Mode"; Value = $SafeNetAuthMode; }) > $Null                                           $ScriptInformation.Add(@{Data = "          Mode"; Value = $SafeNetAuthMode; }) > $Null
                                $ScriptInformation.Add(@{Data = "          TMS Web API URL"; Value = $RAS2FASettings.SafeNetSettings.TMSWebApiURL; }) > $Null                                           $ScriptInformation.Add(@{Data = "          TMS Web API URL"; Value = $RASMFASetting.TMSWebApiURL; }) > $Null
                                $ScriptInformation.Add(@{Data = "          User Repository"; Value = $RAS2FASettings.SafeNetSettings.UserRepository; }) > $Null                                           $ScriptInformation.Add(@{Data = "          User Repository"; Value = $RASMFASetting.UserRepository; }) > $Null
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "GAuthTOTP")                                   ElseIf($RASMFASetting.Type -eq "GAuthTOTP")
                        {                                   {
                                Switch($RAS2FASettings.GAuthTOTPSettings.UserEnrollment)                                           Switch($RASMFASetting.UserEnrollment)
                                {                                           {
                                        "Allow"                 {$GAuthAllow = "Allow"; Break}                                                   "Allow"                 {$GAuthAllow = "Allow"; Break}
                                        "AllowUntil"    {$GAuthAllow = "Allow until"; Break}                                                   "AllowUntil"    {$GAuthAllow = "Allow until"; Break}
                                        "DoNotAllow"    {$GAuthAllow = "Do not allow"; Break}                                                   "DoNotAllow"    {$GAuthAllow = "Do not allow"; Break}
                                        Default                 {$GAuthAllow = "Google Authenticator Allow status not found: $($RAS2FASettings.GAuthTOTPSettings.UserEnrollment)"; Break}                                                   Default                 {$GAuthAllow = "Google Authenticator Allow status not found: $($RASMFASetting.UserEnrollment)"; Break}
                                }                                           }
                                                                          
                                Switch($RAS2FASettings.GAuthTOTPSettings.Tolerance)                                           Switch($RASMFASetting.Tolerance)
                                {                                           {
                                        0               {$TOTPTolerance = "None"; Break}                                                   0               {$TOTPTolerance = "None"; Break}
                                        30              {$TOTPTolerance = "+/- 30 seconds"; Break}                                                   30              {$TOTPTolerance = "+/- 30 seconds"; Break}
                                        60              {$TOTPTolerance = "+/- 60 seconds"; Break}                                                   60              {$TOTPTolerance = "+/- 60 seconds"; Break}
                                        90              {$TOTPTolerance = "+/- 90 seconds"; Break}                                                   90              {$TOTPTolerance = "+/- 90 seconds"; Break}
                                        120             {$TOTPTolerance = "+/- 120 seconds"; Break}                                                   120             {$TOTPTolerance = "+/- 120 seconds"; Break}
                                        Default {$TOTPTolerance = "TOTP tolerence not found: $()"; Break}                                                   Default {$TOTPTolerance = "TOTP tolerence not found: $()"; Break}
                                }                                           }
                                                                          
                                $ScriptInformation.Add(@{Data = "     Type Name"; Value = $RAS2FASettings.GAuthTOTPSettings.Type; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Type Name"; Value = $RASMFASetting.Type; }) > $Null
                                $ScriptInformation.Add(@{Data = "     User Enrollment"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     User Enrollment"; Value = ""; }) > $Null
                                If($GAuthAllow -eq "Allow until")                                           If($GAuthAllow -eq "Allow until")
                                {                                           {
                                        $GAuthFullDate = $RAS2FASettings.GAuthTOTPSettings.UntilDateTime                                                   $GAuthFullDate = $RASMFASetting.UntilDateTime
                                        $GAuthDate     = ($GAuthFullDate.ToUniversalTime()).ToShortDateString()                                                   $GAuthDate     = ($GAuthFullDate.ToUniversalTime()).ToShortDateString()
                                        $GAuthTime     = ($GAuthFullDate.ToUniversalTime()).ToLongTimeString()                                                   $GAuthTime     = ($GAuthFullDate.ToUniversalTime()).ToLongTimeString()
                                        $ScriptInformation.Add(@{Data = "          $GAuthAllow"; Value = "Date: $GAuthDate"; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          $GAuthAllow"; Value = "Date: $GAuthDate"; }) > $Null
                                        $ScriptInformation.Add(@{Data = ""; Value = "Time: $GAuthTime"; }) > $Null                                                   $ScriptInformation.Add(@{Data = ""; Value = "Time: $GAuthTime"; }) > $Null
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $ScriptInformation.Add(@{Data = "          $GAuthAllow"; Value = ""; }) > $Null                                                   $ScriptInformation.Add(@{Data = "          $GAuthAllow"; Value = ""; }) > $Null
                                }                                           }
                                $ScriptInformation.Add(@{Data = "     Authentication"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "     Authentication"; Value = ""; }) > $Null
                                $ScriptInformation.Add(@{Data = "          TOTP tolerence"; Value = $TOTPTolerance; }) > $Null                                           $ScriptInformation.Add(@{Data = "          TOTP tolerence"; Value = $TOTPTolerance; }) > $Null
                        }                                   }
 
                        If($RAS2FASettings.RestrictionMode -eq "Exclusion") <>                                 <#If($RASMFASetting.RestrictionMode -eq "Exclusion")
                        {                                   {
                                $ScriptInformation.Add(@{Data = "Enable MFA for all users except"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "Enable MFA for all users except"; Value = ""; }) > $Null
                        }                                   }
                        Else                                   Else
                        {                                   {
                                $ScriptInformation.Add(@{Data = "Disable MFA for all users except"; Value = ""; }) > $Null                                           $ScriptInformation.Add(@{Data = "Disable MFA for all users except"; Value = ""; }) > $Null
                        }                                   }#>
                                                          
                        $Table = AddWordTable -Hashtable $ScriptInformation `                                   $Table = AddWordTable -Hashtable $ScriptInformation `
                        -Columns Data,Value `                                   -Columns Data,Value `
                        -List `                                   -List `
                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                        $Table.Columns.Item(1).Width = 250; <>                                 $Table.Columns.Item(1).Width = 250;
                        $Table.Columns.Item(2).Width = 175;                                   $Table.Columns.Item(2).Width = 175;
 
                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                        $Table = $Null                                   $Table = $Null
                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""
 
                        WriteWordLine 3 0 "Restriction" <>                                 <#WriteWordLine 3 0 "Restrictions"
                        $ScriptInformation = New-Object System.Collections.ArrayList                                   $ScriptInformation = New-Object System.Collections.ArrayList
                        $ScriptInformation.Add(@{Data = "User or group list"; Value = $RAS2FASettings.ExcludeUserGroup.ToString(); }) > $Null                                   $ScriptInformation.Add(@{Data = "User or group list"; Value = $RASMFASetting.ExcludeUserGroup.ToString(); }) > $Null
                        If($RAS2FASettings.ExcludeUserGroup)                                   If($RASMFASetting.ExcludeUserGroup)
                        {                                   {
                                If($RAS2FASettings.ExcludeUserGroupList.Count -gt 0)                                           If($RASMFASetting.ExcludeUserGroupList.Count -gt 0)
                                {                                           {
                                        ForEach($Item in $RAS2FASettings.ExcludeUserGroupList)                                                   ForEach($Item in $RASMFASetting.ExcludeUserGroupList)
                                        {                                                   {
                                                $ScriptInformation.Add(@{Data = ""; Value = "User: $($Item.Account)"; }) > $Null                                                           $ScriptInformation.Add(@{Data = ""; Value = "User: $($Item.Account)"; }) > $Null
                                                $ScriptInformation.Add(@{Data = ""; Value = "Type: $($Item.Type)"; }) > $Null                                                           $ScriptInformation.Add(@{Data = ""; Value = "Type: $($Item.Type)"; }) > $Null
                                                $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null                                                           $ScriptInformation.Add(@{Data = ""; Value = ""; }) > $Null
                                        }                                                   }
                                }                                           }
                        }                                   }
 
                        $ScriptInformation.Add(@{Data = "Client IP list"; Value = $RAS2FASettings.ExcludeClientIPs.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Client IP list"; Value = $RASMFASetting.ExcludeClientIPs.ToString(); }) > $Null
                        If($RAS2FASettings.ExcludeClientIPs)                                   If($RASMFASetting.ExcludeClientIPs)
                        {                                   {
                                If($RAS2FASettings.ExcludeClientIPList.Count -gt 0)                                           If($RASMFASetting.ExcludeClientIPList.Count -gt 0)
                                {                                           {
                                        $cnt     = -1                                                   $cnt     = -1
                                        $MaxFrom = (($RAS2FASettings.ExcludeClientIPList.From | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxFrom = (($RASMFASetting.ExcludeClientIPList.From | Measure-Object -Property length -maximum).Maximum * -1)
                                        $MaxTo   = (($RAS2FASettings.ExcludeClientIPList.To | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxTo   = (($RASMFASetting.ExcludeClientIPList.To | Measure-Object -Property length -maximum).Maximum * -1)
 
                                        ForEach($Item in $RAS2FASettings.ExcludeClientIPList) <>                                                 ForEach($Item in $RASMFASetting.ExcludeClientIPList)
                                        {                                                   {
                                                $cnt++                                                           $cnt++
                                                $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)                                                           $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)
                                                                                                          
                                                If($cnt -eq 0)                                                           If($cnt -eq 0)
                                                {                                                           {
                                                        $ScriptInformation.Add(@{Data = "     IPv4 Addresses"; Value = $tmp; }) > $Null                                                                   $ScriptInformation.Add(@{Data = "     IPv4 Addresses"; Value = $tmp; }) > $Null
                                                }                                                           }
                                                Else                                                           Else
                                                {                                                           {
                                                        $ScriptInformation.Add(@{Data = ""; Value = $tmp; }) > $Null                                                                   $ScriptInformation.Add(@{Data = ""; Value = $tmp; }) > $Null
                                                }                                                           }
                                        }                                                   }
                                }                                           }
                                                                          
                                If($RAS2FASettings.ExcludeClientIPv6List.Count -gt 0)                                           If($RASMFASetting.ExcludeClientIPv6List.Count -gt 0)
                                {                                           {
                                        $cnt     = -1                                                   $cnt     = -1
                                        $MaxFrom = (($RAS2FASettings.ExcludeClientIPv6List.From | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxFrom = (($RASMFASetting.ExcludeClientIPv6List.From | Measure-Object -Property length -maximum).Maximum * -1)
                                        $MaxTo   = (($RAS2FASettings.ExcludeClientIPv6List.To | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxTo   = (($RASMFASetting.ExcludeClientIPv6List.To | Measure-Object -Property length -maximum).Maximum * -1)
 
                                        ForEach($Item in $RAS2FASettings.ExcludeClientIPv6List) <>                                                 ForEach($Item in $RASMFASetting.ExcludeClientIPv6List)
                                        {                                                   {
                                                $cnt++                                                           $cnt++
                                                $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)                                                           $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)
                                                                                                          
                                                If($cnt -eq 0)                                                           If($cnt -eq 0)
                                                {                                                           {
                                                        $ScriptInformation.Add(@{Data = "     IPv6 Addresses"; Value = $tmp; }) > $Null                                                                   $ScriptInformation.Add(@{Data = "     IPv6 Addresses"; Value = $tmp; }) > $Null
                                                }                                                           }
                                                Else                                                           Else
                                                {                                                           {
                                                        $ScriptInformation.Add(@{Data = ""; Value = $tmp; }) > $Null                                                                   $ScriptInformation.Add(@{Data = ""; Value = $tmp; }) > $Null
                                                }                                                           }
                                        }                                                   }
                                }                                           }
                        }                                   }
 
                        $ScriptInformation.Add(@{Data = "Client MAC list"; Value = $RAS2FASettings.ExcludeClientMAC.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Client MAC list"; Value = $RASMFASetting.ExcludeClientMAC.ToString(); }) > $Null
                        If($RAS2FASettings.ExcludeClientMAC)                                   If($RASMFASetting.ExcludeClientMAC)
                        {                                   {
                                $cnt = -1                                           $cnt = -1
                                ForEach($MAC in $RAS2FASettings.ExcludeClientMACList)                                           ForEach($MAC in $RASMFASetting.ExcludeClientMACList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                                                                          
                                        If($cnt -eq 0)                                                   If($cnt -eq 0)
                                        {                                                   {
                                                $ScriptInformation.Add(@{Data = "     MAC Address"; Value = $MAC; }) > $Null                                                           $ScriptInformation.Add(@{Data = "     MAC Address"; Value = $MAC; }) > $Null
                                        }                                                   }
                                        Else                                                   Else
                                        {                                                   {
                                                $ScriptInformation.Add(@{Data = ""; Value = $MAC; }) > $Null                                                           $ScriptInformation.Add(@{Data = ""; Value = $MAC; }) > $Null
                                        }                                                   }
                                }                                           }
                        }                                   }
 
                        $ScriptInformation.Add(@{Data = "Connection to the following Gateway IPs"; Value = $RAS2FASettings.ExcludeClientGWIPs.ToString(); }) > $Null <>                                 $ScriptInformation.Add(@{Data = "Connection to the following Gateway IPs"; Value = $RASMFASetting.ExcludeClientGWIPs.ToString(); }) > $Null
                        If($RAS2FASettings.ExcludeClientGWIPs)                                   If($RASMFASetting.ExcludeClientGWIPs)
                        {                                   {
                                $cnt = -1                                           $cnt = -1
                                ForEach($Server in $RAS2FASettings.ExcludeClientGWIPList)                                           ForEach($Server in $RASMFASetting.ExcludeClientGWIPList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                                                                          
                                        If($cnt -eq 0)                                                   If($cnt -eq 0)
                                        {                                                   {
                                                $ScriptInformation.Add(@{Data = "     Server Name"; Value = $Server; }) > $Null                                                           $ScriptInformation.Add(@{Data = "     Server Name"; Value = $Server; }) > $Null
                                        }                                                   }
                                        Else                                                   Else
                                        {                                                   {
                                                $ScriptInformation.Add(@{Data = ""; Value = $Server; }) > $Null                                                           $ScriptInformation.Add(@{Data = ""; Value = $Server; }) > $Null
                                        }                                                   }
                                }                                           }
                        }                                   }
 
                        $Table = AddWordTable -Hashtable $ScriptInformation ` <>                                 $Table = AddWordTable -Hashtable $ScriptInformation `
                        -Columns Data,Value `                                   -Columns Data,Value `
                        -List `                                   -List `
                        -Format $wdTableGrid `                                   -Format $wdTableGrid `
                        -AutoFit $wdAutoFitFixed;                                   -AutoFit $wdAutoFitFixed;
 
                        SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite <>                                 SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                        SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;                                   SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
 
                        $Table.Columns.Item(1).Width = 250; <>                                 $Table.Columns.Item(1).Width = 250;
                        $Table.Columns.Item(2).Width = 250;                                   $Table.Columns.Item(2).Width = 250;
 
                        $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional) <>                                 $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
 
                        FindWordDocumentEnd <>                                 FindWordDocumentEnd
                        $Table = $Null                                   $Table = $Null
                        WriteWordLine 0 0 ""                                   WriteWordLine 0 0 ""#>
                }                           }
     
                $ScriptInformation = New-Object System.Collections.ArrayList    
                $ScriptInformation.Add(@{Data = "Settings are replicated to all Sites"; Value = $RAS2FASettings.ReplicateSettings.ToString(); }) > $Null    
     
                $Table = AddWordTable -Hashtable $ScriptInformation `    
                -Columns Data,Value `    
                -List `    
                -Format $wdTableGrid `    
                -AutoFit $wdAutoFitFixed;    
     
                SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite    
                SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;    
     
                $Table.Columns.Item(1).Width = 250;    
                $Table.Columns.Item(2).Width = 175;    
     
                $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)    
     
                FindWordDocumentEnd    
                $Table = $Null    
                WriteWordLine 0 0 ""    
        }                   }
        If($Text)                   If($Text)
        {                   {
                Line 2 "Provider settings"                           Line 2 "Provider settings"
                Line 3 "Provider: " $RAS2FASettingsProvider                           Line 3 "Provider: " $RASMFASettingProvider
                If($RAS2FASettingsProvider -ne "None")                           If($RASMFASettingProvider -ne "None")
                {                           {
                        Line 3 "Settings"                                   Line 3 "Settings"
                                                          
                        If($RAS2FASettings.Provider -eq "AzureRadius")                                   If($RASMFASetting.Type -eq "AzureRadius")
                        {                                   {
                                            Line 4 "General"
                                            Line 5 "Enable MFA provider in site: " $RASMFASetting.Enabled.ToString()
                                            Line 5 "Name: " $RASMFASetting.Name
                                            Line 5 "Description: " $RASMFASetting.Description
                                            Line 5 "Type: " $RASMFASetting.DisplayName
                                Line 4 "Connection"                                           Line 4 "Connection"
                                            Line 5 "Display Name: " $RASMFASetting.DisplayName
                                            Line 5 "Primary server: " $RASMFASetting.Server
                                            Line 5 "Secondary server: " $RASMFASetting.BackupServer
                                            If($RASMFASetting.HAMode -eq "Parallel")
                                            {
                                                    Line 5 "HA mode: Active - active (parallel)"
                                            }
                                            Else
                                            {
                                                    Line 5 "HA mode: Active - passive (failover)"
                                            }
                                            Line 5 "Port: " $RASMFASetting.Port
                                            Line 5 "Timeout (seconds): " $RASMFASetting.Timeout
                                            Line 5 "Retries: " $RASMFASetting.Retries
                                            Line 5 "Password Encoding: " $RASMFASetting.PasswordEncoding
                                            Line 5 "Forward username only to Radius Server: " $RASMFASetting.UsernameOnly.ToString()
                                            Line 5 "Forward the first password to Windows authentication provider: " $RASMFASetting.ForwardFirstPwdToAD.ToString()
                                            Line 4 "Attributes"
                                            $cnt=0
                                            ForEach($Item in $RASMFASetting.AttributeInfoList)
                                            {
                                                    $cnt++
                                                    Line 5 "Attribute $cnt"
                                                    Line 6 "Name: $($Item.RadiusAttrName)"
                                                    Line 6 "Vendor: $($Item.VendorID)"
                                                    Line 6 "Type: $($Item.AttributeType)"
                                                    Line 6 "Value: $($Item.Value)"
                                                    Line 5 "" #blank separator line
                                            }
                                            Line 5 "Automation"
                                            $cnt=0
                                            ForEach($Item in $RASMFASetting.AutomationInfoList)
                                            {
                                                    $cnt++
                                                    Line 5 "Automation $cnt"
                                                    Line 6 "Enable Action: $($Item.Enabled.ToString())"
                                                    Line 6 "Title: $($Item.Title)"
                                                    Line 6 "Command: $($Item.Command)"
                                                    Line 6 "Description: $($Item.Description)"
                                                    Line 6 "Action message: $($Item.ActionMessage)"
                                                    Line 6 "Image: $($Item.Image)"
                                                    Line 6 "Autosend: $($Item.AutoSend.ToString())"
                                                    Line 6 "" #blank separator line
                                            }
                                            Line 0 ""
                                    }
                                    ElseIf($RASMFASetting.Type -eq "DuoRadius")
                                    {
                                            Line 4 "Connection"
                                Line 5 "Type Name`t`t`t`t: " $RAS2FASettings.AzureRadiusSettings.TypeName                                           Line 5 "Type Name`t`t`t`t: " $RASMFASetting.DisplayName
                                Line 5 "Primary Server`t`t`t`t: " $RAS2FASettings.AzureRadiusSettings.Server                                           Line 5 "Primary Server`t`t`t`t: " $RASMFASetting.Server
                                Line 5 "Secondary server`t`t`t: " $RAS2FASettings.AzureRadiusSettings.BackupServer                                           Line 5 "Secondary server`t`t`t: " $RASMFASetting.BackupServer
                                If($RAS2FASettings.AzureRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"
                                }                                           }
                                Line 5 "Port`t`t`t`t`t: " $RAS2FASettings.AzureRadiusSettings.Port                                           Line 5 "Port`t`t`t`t`t: " $RASMFASetting.Port
                                Line 5 "Timeout`t`t`t`t`t: " $RAS2FASettings.AzureRadiusSettings.Timeout                                           Line 5 "Timeout`t`t`t`t`t: " $RASMFASetting.Timeout
                                Line 5 "Retries`t`t`t`t`t: " $RAS2FASettings.AzureRadiusSettings.Retries                                           Line 5 "Retries`t`t`t`t`t: " $RASMFASetting.Retries
                                Line 5 "Password Encoding`t`t`t: " $RAS2FASettings.AzureRadiusSettings.PasswordEncoding                                           Line 5 "Password Encoding`t`t`t: " $RASMFASetting.PasswordEncoding
                                Line 5 "Forward username only to Radius Server`t: " $RAS2FASettings.AzureRadiusSettings.UsernameOnly.ToString()                                           Line 5 "Forward username only to Radius Server`t: " $RASMFASetting.UsernameOnly.ToString()
                                Line 5 "Forward the first password to "                                           Line 5 "Forward the first password to "
                                Line 5 "Windows authentication provider`t`t: " $RAS2FASettings.AzureRadiusSettings.ForwardFirstPwdToAD.ToString()                                           Line 5 "Windows authentication provider`t`t: " $RASMFASetting.ForwardFirstPwdToAD.ToString()
                                Line 4 "Attributes"                                           Line 4 "Attributes"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.AzureRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "Attribute $cnt"                                                   Line 5 "Attribute $cnt"
                                        Line 6 "Name  : $($Item.Name)"                                                   Line 6 "Name  : $($Item.Name)"
                                        Line 6 "Vendor: $($Item.Vendor)"                                                   Line 6 "Vendor: $($Item.Vendor)"
                                        Line 6 "Type  : $($Item.AttributeType)"                                                   Line 6 "Type  : $($Item.AttributeType)"
                                        Line 6 "Value : $($Item.Value)"                                                   Line 6 "Value : $($Item.Value)"
                                        Line 5 "" #blank separator line                                                   Line 5 "" #blank separator line
                                }                                           }
                                Line 4 "Automation"                                           Line 4 "Automation"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.AzureRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "" "Automation $cnt"                                                   Line 5 "" "Automation $cnt"
                                        Line 6 "Enabled : $($Item.Enabled.ToString())"                                                   Line 6 "Enabled : $($Item.Enabled.ToString())"
                                        Line 6 "Title   : $($Item.Title)"                                                   Line 6 "Title   : $($Item.Title)"
                                        Line 6 "Command : $($Item.Command)"                                                   Line 6 "Command : $($Item.Command)"
                                        Line 6 "Image   : $($Item.Image)"                                                   Line 6 "Image   : $($Item.Image)"
                                        Line 6 "Autosend: $($Item.AutoSend.ToString())"                                                   Line 6 "Autosend: $($Item.AutoSend.ToString())"
                                        Line 5 "" "" #blank separator line                                                   Line 5 "" "" #blank separator line
                                }                                           }
                                Line 0 ""                                           Line 0 ""
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "DuoRadius")                                   ElseIf($RASMFASetting.Type -eq "FortiRadius")
                        {                                   {
                                Line 4 "Connection"                                           Line 4 "Connection"
                                Line 5 "Type Name`t`t`t`t: " $RAS2FASettings.DuoRadiusSettings.TypeName                                           Line 5 "Type Name`t`t`t`t: " $RASMFASetting.DisplayName
                                Line 5 "Primary Server`t`t`t`t: " $RAS2FASettings.DuoRadiusSettings.Server                                           Line 5 "Primary Server`t`t`t`t: " $RASMFASetting.Server
                                Line 5 "Secondary server`t`t`t: " $RAS2FASettings.DuoRadiusSettings.BackupServer                                           Line 5 "Secondary server`t`t`t: " $RASMFASetting.BackupServer
                                If($RAS2FASettings.DuoRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"
                                }                                           }
                                Line 5 "Port`t`t`t`t`t: " $RAS2FASettings.DuoRadiusSettings.Port                                           Line 5 "Port`t`t`t`t`t: " $RASMFASetting.Port
                                Line 5 "Timeout`t`t`t`t`t: " $RAS2FASettings.DuoRadiusSettings.Timeout                                           Line 5 "Timeout`t`t`t`t`t: " $RASMFASetting.Timeout
                                Line 5 "Retries`t`t`t`t`t: " $RAS2FASettings.DuoRadiusSettings.Retries                                           Line 5 "Retries`t`t`t`t`t: " $RASMFASetting.Retries
                                Line 5 "Password Encoding`t`t`t: " $RAS2FASettings.DuoRadiusSettings.PasswordEncoding                                           Line 5 "Password Encoding`t`t`t: " $RASMFASetting.PasswordEncoding
                                Line 5 "Forward username only to Radius Server`t: " $RAS2FASettings.DuoRadiusSettings.UsernameOnly.ToString()                                           Line 5 "Forward username only to Radius Server`t: " $RASMFASetting.UsernameOnly.ToString()
                                Line 5 "Forward the first password to "                                           Line 5 "Forward the first password to "
                                Line 5 "Windows authentication provider`t`t: " $RAS2FASettings.DuoRadiusSettings.ForwardFirstPwdToAD.ToString()                                           Line 5 "Windows authentication provider`t`t: " $RASMFASetting.ForwardFirstPwdToAD.ToString()
                                Line 4 "Attributes"                                           Line 4 "Attributes"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.DuoRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "Attribute $cnt"                                                   Line 5 "Attribute $cnt"
                                        Line 6 "Name  : $($Item.Name)"                                                   Line 6 "Name  : $($Item.Name)"
                                        Line 6 "Vendor: $($Item.Vendor)"                                                   Line 6 "Vendor: $($Item.Vendor)"
                                        Line 6 "Type  : $($Item.AttributeType)"                                                   Line 6 "Type  : $($Item.AttributeType)"
                                        Line 6 "Value : $($Item.Value)"                                                   Line 6 "Value : $($Item.Value)"
                                        Line 5 "" #blank separator line                                                   Line 5 "" #blank separator line
                                }                                           }
                                Line 4 "Automation"                                           Line 4 "Automation"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.DuoRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "" "Automation $cnt"                                                   Line 5 "" "Automation $cnt"
                                        Line 6 "Enabled : $($Item.Enabled.ToString())"                                                   Line 6 "Enabled : $($Item.Enabled.ToString())"
                                        Line 6 "Title   : $($Item.Title)"                                                   Line 6 "Title   : $($Item.Title)"
                                        Line 6 "Command : $($Item.Command)"                                                   Line 6 "Command : $($Item.Command)"
                                        Line 6 "Image   : $($Item.Image)"                                                   Line 6 "Image   : $($Item.Image)"
                                        Line 6 "Autosend: $($Item.AutoSend.ToString())"                                                   Line 6 "Autosend: $($Item.AutoSend.ToString())"
                                        Line 5 "" "" #blank separator line                                                   Line 5 "" "" #blank separator line
                                }                                           }
                                Line 0 ""                                           Line 0 ""
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "FortiRadius")                                   ElseIf($RASMFASetting.Type -eq "TekRadius")
                        {                                   {
                                Line 4 "Connection"                                           Line 4 "Connection"
                                Line 5 "Type Name`t`t`t`t: " $RAS2FASettings.FortiRadiusSettings.TypeName                                           Line 5 "Type Name`t`t`t`t: " $RASMFASetting.DisplayName
                                Line 5 "Primary Server`t`t`t`t: " $RAS2FASettings.FortiRadiusSettings.Server                                           Line 5 "Primary Server`t`t`t`t: " $RASMFASetting.Server
                                Line 5 "Secondary server`t`t`t: " $RAS2FASettings.FortiRadiusSettings.BackupServer                                           Line 5 "Secondary server`t`t`t: " $RASMFASetting.BackupServer
                                If($RAS2FASettings.FortiRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"
                                }                                           }
                                Line 5 "Port`t`t`t`t`t: " $RAS2FASettings.FortiRadiusSettings.Port                                           Line 5 "Port`t`t`t`t`t: " $RASMFASetting.Port
                                Line 5 "Timeout`t`t`t`t`t: " $RAS2FASettings.FortiRadiusSettings.Timeout                                           Line 5 "Timeout`t`t`t`t`t: " $RASMFASetting.Timeout
                                Line 5 "Retries`t`t`t`t`t: " $RAS2FASettings.FortiRadiusSettings.Retries                                           Line 5 "Retries`t`t`t`t`t: " $RASMFASetting.Retries
                                Line 5 "Password Encoding`t`t`t: " $RAS2FASettings.FortiRadiusSettings.PasswordEncoding                                           Line 5 "Password Encoding`t`t`t: " $RASMFASetting.PasswordEncoding
                                Line 5 "Forward username only to Radius Server`t: " $RAS2FASettings.FortiRadiusSettings.UsernameOnly.ToString()                                           Line 5 "Forward username only to Radius Server`t: " $RASMFASetting.UsernameOnly.ToString()
                                Line 5 "Forward the first password to "                                           Line 5 "Forward the first password to "
                                Line 5 "Windows authentication provider`t`t: " $RAS2FASettings.FortiRadiusSettings.ForwardFirstPwdToAD.ToString()                                           Line 5 "Windows authentication provider`t`t: " $RASMFASetting.ForwardFirstPwdToAD.ToString()
                                Line 4 "Attributes"                                           Line 4 "Attributes"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.FortiRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "Attribute $cnt"                                                   Line 5 "Attribute $cnt"
                                        Line 6 "Name  : $($Item.Name)"                                                   Line 6 "Name  : $($Item.Name)"
                                        Line 6 "Vendor: $($Item.Vendor)"                                                   Line 6 "Vendor: $($Item.Vendor)"
                                        Line 6 "Type  : $($Item.AttributeType)"                                                   Line 6 "Type  : $($Item.AttributeType)"
                                        Line 6 "Value : $($Item.Value)"                                                   Line 6 "Value : $($Item.Value)"
                                        Line 5 "" #blank separator line                                                   Line 5 "" #blank separator line
                                }                                           }
                                Line 4 "Automation"                                           Line 4 "Automation"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.FortiRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "" "Automation $cnt"                                                   Line 5 "" "Automation $cnt"
                                        Line 6 "Enabled : $($Item.Enabled.ToString())"                                                   Line 6 "Enabled : $($Item.Enabled.ToString())"
                                        Line 6 "Title   : $($Item.Title)"                                                   Line 6 "Title   : $($Item.Title)"
                                        Line 6 "Command : $($Item.Command)"                                                   Line 6 "Command : $($Item.Command)"
                                        Line 6 "Image   : $($Item.Image)"                                                   Line 6 "Image   : $($Item.Image)"
                                        Line 6 "Autosend: $($Item.AutoSend.ToString())"                                                   Line 6 "Autosend: $($Item.AutoSend.ToString())"
                                        Line 5 "" "" #blank separator line                                                   Line 5 "" "" #blank separator line
                                }                                           }
                                Line 0 ""                                           Line 0 ""
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "TekRadius")                                   ElseIf($RASMFASetting.Type -eq "Radius")
                        {                                   {
                                Line 4 "Connection"                                           Line 4 "Connection"
                                Line 5 "Type Name`t`t`t`t: " $RAS2FASettings.TekRadiusSettings.TypeName                                           Line 5 "Type Name`t`t`t`t: " $RASMFASetting.DisplayName
                                Line 5 "Primary Server`t`t`t`t: " $RAS2FASettings.TekRadiusSettings.Server                                           Line 5 "Primary Server`t`t`t`t: " $RASMFASetting.Server
                                Line 5 "Secondary server`t`t`t: " $RAS2FASettings.TekRadiusSettings.BackupServer                                           Line 5 "Secondary server`t`t`t: " $RASMFASetting.BackupServer
                                If($RAS2FASettings.TekRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"                                                   Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"
                                }                                           }
                                Line 5 "Port`t`t`t`t`t: " $RAS2FASettings.TekRadiusSettings.Port                                           Line 5 "Port`t`t`t`t`t: " $RASMFASetting.Port
                                Line 5 "Timeout`t`t`t`t`t: " $RAS2FASettings.TekRadiusSettings.Timeout                                           Line 5 "Timeout`t`t`t`t`t: " $RASMFASetting.Timeout
                                Line 5 "Retries`t`t`t`t`t: " $RAS2FASettings.TekRadiusSettings.Retries                                           Line 5 "Retries`t`t`t`t`t: " $RASMFASetting.Retries
                                Line 5 "Password Encoding`t`t`t: " $RAS2FASettings.TekRadiusSettings.PasswordEncoding                                           Line 5 "Password Encoding`t`t`t: " $RASMFASetting.PasswordEncoding
                                Line 5 "Forward username only to Radius Server`t: " $RAS2FASettings.TekRadiusSettings.UsernameOnly.ToString()                                           Line 5 "Forward username only to Radius Server`t: " $RASMFASetting.UsernameOnly.ToString()
                                Line 5 "Forward the first password to "                                           Line 5 "Forward the first password to "
                                Line 5 "Windows authentication provider`t`t: " $RAS2FASettings.TekRadiusSettings.ForwardFirstPwdToAD.ToString()                                           Line 5 "Windows authentication provider`t`t: " $RASMFASetting.ForwardFirstPwdToAD.ToString()
                                Line 4 "Attributes"                                           Line 4 "Attributes"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.TekRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "Attribute $cnt"                                                   Line 5 "Attribute $cnt"
                                        Line 6 "Name  : $($Item.Name)"                                                   Line 6 "Name  : $($Item.Name)"
                                        Line 6 "Vendor: $($Item.Vendor)"                                                   Line 6 "Vendor: $($Item.Vendor)"
                                        Line 6 "Type  : $($Item.AttributeType)"                                                   Line 6 "Type  : $($Item.AttributeType)"
                                        Line 6 "Value : $($Item.Value)"                                                   Line 6 "Value : $($Item.Value)"
                                        Line 5 "" #blank separator line                                                   Line 5 "" #blank separator line
                                }                                           }
                                Line 4 "Automation"                                           Line 4 "Automation"
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.TekRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        Line 5 "" "Automation $cnt"                                                   Line 5 "" "Automation $cnt"
                                        Line 6 "Enabled : $($Item.Enabled.ToString())"                                                   Line 6 "Enabled : $($Item.Enabled.ToString())"
                                        Line 6 "Title   : $($Item.Title)"                                                   Line 6 "Title   : $($Item.Title)"
                                        Line 6 "Command : $($Item.Command)"                                                   Line 6 "Command : $($Item.Command)"
                                        Line 6 "Image   : $($Item.Image)"                                                   Line 6 "Image   : $($Item.Image)"
                                        Line 6 "Autosend: $($Item.AutoSend.ToString())"                                                   Line 6 "Autosend: $($Item.AutoSend.ToString())"
                                        Line 5 "" "" #blank separator line                                                   Line 5 "" "" #blank separator line
                                }                                           }
                                Line 0 ""                                           Line 0 ""
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "Radius")    
                        {    
                                Line 4 "Connection"    
                                Line 5 "Type Name`t`t`t`t: " $RAS2FASettings.RadiusSettings.TypeName    
                                Line 5 "Primary Server`t`t`t`t: " $RAS2FASettings.RadiusSettings.Server    
                                Line 5 "Secondary server`t`t`t: " $RAS2FASettings.RadiusSettings.BackupServer    
                                If($RAS2FASettings.RadiusSettings.HAMode -eq "Parallel")    
                                {    
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - active (parallel)"    
                                }    
                                Else    
                                {    
                                        Line 5 "HA mode`t`t`t`t`t: " "Active - passive (failover)"    
                                }    
                                Line 5 "Port`t`t`t`t`t: " $RAS2FASettings.RadiusSettings.Port    
                                Line 5 "Timeout`t`t`t`t`t: " $RAS2FASettings.RadiusSettings.Timeout    
                                Line 5 "Retries`t`t`t`t`t: " $RAS2FASettings.RadiusSettings.Retries    
                                Line 5 "Password Encoding`t`t`t: " $RAS2FASettings.RadiusSettings.PasswordEncoding    
                                Line 5 "Forward username only to Radius Server`t: " $RAS2FASettings.RadiusSettings.UsernameOnly.ToString()    
                                Line 5 "Forward the first password to "    
                                Line 5 "Windows authentication provider`t`t: " $RAS2FASettings.RadiusSettings.ForwardFirstPwdToAD.ToString()    
                                Line 4 "Attributes"    
                                $cnt=0    
                                ForEach($Item in $RAS2FASettings.RadiusSettings.AttributeInfoList)    
                                {    
                                        $cnt++    
                                        Line 5 "Attribute $cnt"    
                                        Line 6 "Name  : $($Item.Name)"    
                                        Line 6 "Vendor: $($Item.Vendor)"    
                                        Line 6 "Type  : $($Item.AttributeType)"    
                                        Line 6 "Value : $($Item.Value)"    
                                        Line 5 "" #blank separator line    
                                }    
                                Line 4 "Automation"    
                                $cnt=0    
                                ForEach($Item in $RAS2FASettings.RadiusSettings.AutomationInfoList)    
                                {    
                                        $cnt++    
                                        Line 5 "" "Automation $cnt"    
                                        Line 6 "Enabled : $($Item.Enabled.ToString())"    
                                        Line 6 "Title   : $($Item.Title)"    
                                        Line 6 "Command : $($Item.Command)"    
                                        Line 6 "Image   : $($Item.Image)"    
                                        Line 6 "Autosend: $($Item.AutoSend.ToString())"    
                                        Line 5 "" "" #blank separator line    
                                }    
                                Line 0 ""    
                        }    
                        ElseIf($RAS2FASettings.Provider -eq "Deepnet")                                   ElseIf($RASMFASetting.Type -eq "Deepnet")
                        {                                   {
                                Line 4 "Connection"                                           Line 4 "Connection"
                                Line 5 "Type`t`t: " $RAS2FASettings.DeepnetSettings.DeepnetType                                           Line 5 "Type`t`t: " $RASMFASetting.DeepnetType
                                Line 5 "Server`t`t: " $RAS2FASettings.DeepnetSettings.Server                                           Line 5 "Server`t`t: " $RASMFASetting.Server
                                Line 5 "Port`t`t: " $RAS2FASettings.DeepnetSettings.Port.ToString()                                           Line 5 "Port`t`t: " $RASMFASetting.Port.ToString()
                                Line 5 "Enable SSL`t: " $RAS2FASettings.DeepnetSettings.SSL.ToString()                                           Line 5 "Enable SSL`t: " $RASMFASetting.SSL.ToString()
                                Line 5 "Agent`t`t: " $RAS2FASettings.DeepnetSettings.DeepnetAgent                                           Line 5 "Agent`t`t: " $RASMFASetting.DeepnetAgent
                                Line 4 "Application"                                           Line 4 "Application"
                                Line 5 "          Application`t: " $RAS2FASettings.DeepnetSettings.App                                           Line 5 "          Application`t: " $RASMFASetting.App
                                Line 5 "          Domain`t: " $RAS2FASettings.DeepnetSettings.DefaultDomain                                           Line 5 "          Domain`t: " $RASMFASetting.DefaultDomain
                                Line 4 "Authentication"                                           Line 4 "Authentication"
                                Line 5 "          Mode`t`t: " $DeepNetAuthMode                                           Line 5 "          Mode`t`t: " $DeepNetAuthMode
                                Line 5 "          Token Type`t: " $RAS2FASettings.DeepnetSettings.TokenType.ToString()                                           Line 5 "          Token Type`t: " $RASMFASetting.TokenType.ToString()
                                Line 5 "          Allow Channels: " "Email: $($RAS2FASettings.DeepnetSettings.ActivateEmail.ToString())"                                           Line 5 "          Allow Channels: " "Email: $($RASMFASetting.ActivateEmail.ToString())"
                                Line 5 "                          " "SMS: $($RAS2FASettings.DeepnetSettings.ActivateSMS.ToString())"                                           Line 5 "                          " "SMS: $($RASMFASetting.ActivateSMS.ToString())"
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "SafeNet")                                   ElseIf($RASMFASetting.Type -eq "SafeNet")
                        {                                   {
                                Switch($RAS2FASettings.SafeNetSettings.AuthMode)                                           Switch($RASMFASetting.AuthMode)
                                {                                           {
                                        "MandatoryForAllUsers"                                          {$SafeNetAuthMode = "Mandatory for all users"; Break}                                                   "MandatoryForAllUsers"                                          {$SafeNetAuthMode = "Mandatory for all users"; Break}
                                        "CreateTokenForDomainAuthenticatedUsers"        {$SafeNetAuthMode = "Create token for Domain Authenticated users"; Break}                                                   "CreateTokenForDomainAuthenticatedUsers"        {$SafeNetAuthMode = "Create token for Domain Authenticated users"; Break}
                                        "UsersWithSafeNetAcc"                                           {$SafeNetAuthMode = "Use only for users with a safe account"; Break}                                                   "UsersWithSafeNetAcc"                                           {$SafeNetAuthMode = "Use only for users with a safe account"; Break}
                                        Default                                                                         {$SafeNetAuthMode = "Safenet mode not found: $($RAS2FASettings.SafeNetSettings.AuthMode)"; Break}                                                   Default                                                                         {$SafeNetAuthMode = "Safenet mode not found: $($RASMFASetting.AuthMode)"; Break}
                                }                                           }
 
                                Line 4 "Connection" <>                                         Line 4 "Connection"
                                Line 5 "OTP Service URL : " $RAS2FASettings.SafeNetSettings.DeepnetType                                           Line 5 "OTP Service URL : " $RASMFASetting.DeepnetType
                                Line 4 "Authentication"                                           Line 4 "Authentication"
                                Line 5 "Mode`t`t`t: " $SafeNetAuthMode                                           Line 5 "Mode`t`t`t: " $SafeNetAuthMode
                                Line 5 "TMS Web API URL`t`t: " $RAS2FASettings.SafeNetSettings.TMSWebApiURL                                           Line 5 "TMS Web API URL`t`t: " $RASMFASetting.TMSWebApiURL
                                Line 5 "User Repository`t`t: " $RAS2FASettings.SafeNetSettings.UserRepository                                           Line 5 "User Repository`t`t: " $RASMFASetting.UserRepository
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "GAuthTOTP")                                   ElseIf($RASMFASetting.Type -eq "GAuthTOTP")
                        {                                   {
                                Switch($RAS2FASettings.GAuthTOTPSettings.UserEnrollment)                                           Switch($RASMFASetting.UserEnrollment)
                                {                                           {
                                        "Allow"                 {$GAuthAllow = "Allow"; Break}                                                   "Allow"                 {$GAuthAllow = "Allow"; Break}
                                        "AllowUntil"    {$GAuthAllow = "Allow until"; Break}                                                   "AllowUntil"    {$GAuthAllow = "Allow until"; Break}
                                        "DoNotAllow"    {$GAuthAllow = "Do not allow"; Break}                                                   "DoNotAllow"    {$GAuthAllow = "Do not allow"; Break}
                                        Default                 {$GAuthAllow = "Google Authenticator Allow status not found: $($RAS2FASettings.GAuthTOTPSettings.UserEnrollment)"; Break}                                                   Default                 {$GAuthAllow = "Google Authenticator Allow status not found: $($RASMFASetting.UserEnrollment)"; Break}
                                }                                           }
                                                                          
                                Switch($RAS2FASettings.GAuthTOTPSettings.Tolerance)                                           Switch($RASMFASetting.Tolerance)
                                {                                           {
                                        0               {$TOTPTolerance = "None"; Break}                                                   0               {$TOTPTolerance = "None"; Break}
                                        30              {$TOTPTolerance = "+/- 30 seconds"; Break}                                                   30              {$TOTPTolerance = "+/- 30 seconds"; Break}
                                        60              {$TOTPTolerance = "+/- 60 seconds"; Break}                                                   60              {$TOTPTolerance = "+/- 60 seconds"; Break}
                                        90              {$TOTPTolerance = "+/- 90 seconds"; Break}                                                   90              {$TOTPTolerance = "+/- 90 seconds"; Break}
                                        120             {$TOTPTolerance = "+/- 120 seconds"; Break}                                                   120             {$TOTPTolerance = "+/- 120 seconds"; Break}
                                        Default {$TOTPTolerance = "TOTP tolerence not found: $()"; Break}                                                   Default {$TOTPTolerance = "TOTP tolerence not found: $()"; Break}
                                }                                           }
                                                                          
                                Line 4 "Type Name: " $RAS2FASettings.GAuthTOTPSettings.Type                                           Line 4 "Type Name: " $RASMFASetting.Type
                                Line 4 "User Enrollment"                                           Line 4 "User Enrollment"
                                Line 5 $GAuthAllow                                           Line 5 $GAuthAllow
                                If($GAuthAllow -eq "Allow until")                                           If($GAuthAllow -eq "Allow until")
                                {                                           {
                                        $GAuthFullDate = $RAS2FASettings.GAuthTOTPSettings.UntilDateTime                                                   $GAuthFullDate = $RASMFASetting.UntilDateTime
                                        $GAuthDate     = ($GAuthFullDate.ToUniversalTime()).ToShortDateString()                                                   $GAuthDate     = ($GAuthFullDate.ToUniversalTime()).ToShortDateString()
                                        $GAuthTime     = ($GAuthFullDate.ToUniversalTime()).ToLongTimeString()                                                   $GAuthTime     = ($GAuthFullDate.ToUniversalTime()).ToLongTimeString()
                                        Line 6 "Date: " $GAuthDate                                                   Line 6 "Date: " $GAuthDate
                                        Line 6 "Time: " $GAuthTime                                                   Line 6 "Time: " $GAuthTime
                                }                                           }
                                Line 4 "Authentication"                                           Line 4 "Authentication"
                                Line 5 "TOTP tolerence: " $TOTPTolerance                                           Line 5 "TOTP tolerence: " $TOTPTolerance
                        }                                   }
 
                        If($RAS2FASettings.RestrictionMode -eq "Exclusion") <>                                 <#If($RASMFASetting.RestrictionMode -eq "Exclusion")
                        {                                   {
                                Line 3 "Enable MFA for all users except"                                           Line 3 "Enable MFA for all users except"
                        }                                   }
                        Else                                   Else
                        {                                   {
                                Line 3 "Disable MFA for all users except"                                           Line 3 "Disable MFA for all users except"
                        }                                   }#>
                        Line 0 ""                                   Line 0 ""
 
                        Line 2 "Restriction" <>                                 <#Line 2 "Restriction"
                        Line 3 "User or group list`t`t`t: " $RAS2FASettings.ExcludeUserGroup.ToString()                                   Line 3 "User or group list`t`t`t: " $RASMFASetting.ExcludeUserGroup.ToString()
                        If($RAS2FASettings.ExcludeUserGroup)                                   If($RASMFASetting.ExcludeUserGroup)
                        {                                   {
                                If($RAS2FASettings.ExcludeUserGroupList.Count -gt 0)                                           If($RASMFASetting.ExcludeUserGroupList.Count -gt 0)
                                {                                           {
                                        ForEach($Item in $RAS2FASettings.ExcludeUserGroupList)                                                   ForEach($Item in $RASMFASetting.ExcludeUserGroupList)
                                        {                                                   {
                                                Line 8 "  " "User: $($Item.Account)"                                                           Line 8 "  " "User: $($Item.Account)"
                                                Line 8 "  " "Type: $($Item.Type)"                                                           Line 8 "  " "Type: $($Item.Type)"
                                                Line 8 "  "                                                           Line 8 "  "
                                        }                                                   }
                                }                                           }
                        }                                   }
                                                                          
                        Line 3 "Client IP list`t`t`t`t: " $RAS2FASettings.ExcludeClientIPs.ToString()                                   Line 3 "Client IP list`t`t`t`t: " $RASMFASetting.ExcludeClientIPs.ToString()
                        If($RAS2FASettings.ExcludeClientIPs)                                   If($RASMFASetting.ExcludeClientIPs)
                        {                                   {
                                If($RAS2FASettings.ExcludeClientIPList.Count -gt 0)                                           If($RASMFASetting.ExcludeClientIPList.Count -gt 0)
                                {                                           {
                                        $cnt     = -1                                                   $cnt     = -1
                                        $MaxFrom = (($RAS2FASettings.ExcludeClientIPList.From | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxFrom = (($RASMFASetting.ExcludeClientIPList.From | Measure-Object -Property length -maximum).Maximum * -1)
                                        $MaxTo   = (($RAS2FASettings.ExcludeClientIPList.To | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxTo   = (($RASMFASetting.ExcludeClientIPList.To | Measure-Object -Property length -maximum).Maximum * -1)
 
                                        ForEach($Item in $RAS2FASettings.ExcludeClientIPList) <>                                                 ForEach($Item in $RASMFASetting.ExcludeClientIPList)
                                        {                                                   {
                                                $cnt++                                                           $cnt++
                                                $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)                                                           $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)
                                                                                                          
                                                If($cnt -eq 0)                                                           If($cnt -eq 0)
                                                {                                                           {
                                                        Line 6 "IPv4 Addresses`t: " $tmp                                                                   Line 6 "IPv4 Addresses`t: " $tmp
                                                }                                                           }
                                                Else                                                           Else
                                                {                                                           {
                                                        Line 8 "  " $tmp                                                                   Line 8 "  " $tmp
                                                }                                                           }
                                        }                                                   }
                                }                                           }
                                                                          
                                If($RAS2FASettings.ExcludeClientIPv6List.Count -gt 0)                                           If($RASMFASetting.ExcludeClientIPv6List.Count -gt 0)
                                {                                           {
                                        $cnt     = -1                                                   $cnt     = -1
                                        $MaxFrom = (($RAS2FASettings.ExcludeClientIPv6List.From | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxFrom = (($RASMFASetting.ExcludeClientIPv6List.From | Measure-Object -Property length -maximum).Maximum * -1)
                                        $MaxTo   = (($RAS2FASettings.ExcludeClientIPv6List.To | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxTo   = (($RASMFASetting.ExcludeClientIPv6List.To | Measure-Object -Property length -maximum).Maximum * -1)
 
                                        ForEach($Item in $RAS2FASettings.ExcludeClientIPv6List) <>                                                 ForEach($Item in $RASMFASetting.ExcludeClientIPv6List)
                                        {                                                   {
                                                $cnt++                                                           $cnt++
                                                $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)                                                           $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)
                                                                                                          
                                                If($cnt -eq 0)                                                           If($cnt -eq 0)
                                                {                                                           {
                                                        Line 6 "IPv6 Addresses`t: " $tmp                                                                   Line 6 "IPv6 Addresses`t: " $tmp
                                                }                                                           }
                                                Else                                                           Else
                                                {                                                           {
                                                        Line 8 "  " $tmp                                                                   Line 8 "  " $tmp
                                                }                                                           }
                                        }                                                   }
                                }                                           }
                        }                                   }
                        Line 3 "Client MAC list`t`t`t`t: " $RAS2FASettings.ExcludeClientMAC.ToString()                                   Line 3 "Client MAC list`t`t`t`t: " $RASMFASetting.ExcludeClientMAC.ToString()
                        If($RAS2FASettings.ExcludeClientMAC)                                   If($RASMFASetting.ExcludeClientMAC)
                        {                                   {
                                $cnt = -1                                           $cnt = -1
                                ForEach($MAC in $RAS2FASettings.ExcludeClientMACList)                                           ForEach($MAC in $RASMFASetting.ExcludeClientMACList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                                                                          
                                        If($cnt -eq 0)                                                   If($cnt -eq 0)
                                        {                                                   {
                                                Line 6 "MAC Address`t: " $MAC                                                           Line 6 "MAC Address`t: " $MAC
                                        }                                                   }
                                        Else                                                   Else
                                        {                                                   {
                                                Line 8 "  " $MAC                                                           Line 8 "  " $MAC
                                        }                                                   }
                                }                                           }
                        }                                   }
                        Line 3 "Connection to the following Gateway IPs`t: " $RAS2FASettings.ExcludeClientGWIPs.ToString()                                   Line 3 "Connection to the following Gateway IPs`t: " $RASMFASetting.ExcludeClientGWIPs.ToString()
                        If($RAS2FASettings.ExcludeClientGWIPs)                                   If($RASMFASetting.ExcludeClientGWIPs)
                        {                                   {
                                $cnt = -1                                           $cnt = -1
                                ForEach($Server in $RAS2FASettings.ExcludeClientGWIPList)                                           ForEach($Server in $RASMFASetting.ExcludeClientGWIPList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                                                                          
                                        If($cnt -eq 0)                                                   If($cnt -eq 0)
                                        {                                                   {
                                                Line 6 "Server Name`t: " $Server                                                           Line 6 "Server Name`t: " $Server
                                        }                                                   }
                                        Else                                                   Else
                                        {                                                   {
                                                Line 8 "  " $Server                                                           Line 8 "  " $Server
                                        }                                                   }
                                }                                           }
                        }                                   }#>
                }                           }
                Line 0 ""                           Line 0 ""
                Line 2 "Settings are replicated to all Sites`t`t: " $RAS2FASettings.ReplicateSettings.ToString()    
                Line 0 ""    
        }                   }
        If($HTML)                   If($HTML)
        {                   {
                $rowdata = @()                           $rowdata = @()
                $columnHeaders = @("Provider",($Script:htmlsb),$RAS2FASettingsProvider,$htmlwhite)                           $columnHeaders = @("Provider",($Script:htmlsb),$RASMFASettingProvider,$htmlwhite)
                If($RAS2FASettingsProvider -ne "None")                           If($RASMFASettingProvider -ne "None")
                {                           {
                        If($RAS2FASettings.Provider -eq "AzureRadius")                                   If($RASMFASetting.Type -eq "AzureRadius")
                        {                                   {
                                            $rowdata += @(,( "     General",($Script:htmlsb),"",$htmlwhite))
                                            $rowdata += @(,("          Enable MFA provider in site",($Script:htmlsb),$RASMFASetting.Enabled.ToString(),$htmlwhite))
                                            $rowdata += @(,("          Name",($Script:htmlsb),$RASMFASetting.Name,$htmlwhite))
                                            $rowdata += @(,("          Description",($Script:htmlsb), $RASMFASetting.Description,$htmlwhite))
                                            $rowdata += @(,("          Type",($Script:htmlsb), $RASMFASetting.DisplayName,$htmlwhite))
                                $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,("          Type Name",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.TypeName,$htmlwhite))                                           $rowdata += @(,("          Display Name",($Script:htmlsb),$RASMFASetting.DisplayName,$htmlwhite))
                                $rowdata += @(,("          Primary Server",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.Server,$htmlwhite))                                           $rowdata += @(,("          Primary Server",($Script:htmlsb),$RASMFASetting.Server,$htmlwhite))
                                $rowdata += @(,("          Secondary server",($Script:htmlsb), $RAS2FASettings.AzureRadiusSettings.BackupServer,$htmlwhite))                                           $rowdata += @(,("          Secondary server",($Script:htmlsb), $RASMFASetting.BackupServer,$htmlwhite))
                                If($RAS2FASettings.AzureRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $rowdata += @(,("          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))                                                   $rowdata += @(,("          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $rowdata += @(,("          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))                                                   $rowdata += @(,("          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))
                                            }
                                            $rowdata += @(,("          Port",($Script:htmlsb),$RASMFASetting.Port,$htmlwhite))
                                            $rowdata += @(,("          Timeout",($Script:htmlsb),$RASMFASetting.Timeout,$htmlwhite))
                                            $rowdata += @(,("          Retries",($Script:htmlsb),$RASMFASetting.Retries,$htmlwhite))
                                            $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RASMFASetting.PasswordEncoding.ToString(),$htmlwhite))
                                            $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RASMFASetting.UsernameOnly.ToString(),$htmlwhite))
                                            $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RASMFASetting.ForwardFirstPwdToAD.ToString(),$htmlwhite))
                                            $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))
                                            $cnt=0
                                            ForEach($Item in $RASMFASetting.AttributeInfoList)
                                            {
                                                    $cnt++
                                                    $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.RadiusAttrName)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.VendorID)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                            }
                                            $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))
                                            $cnt=0
                                            ForEach($Item in $RASMFASetting.AutomationInfoList)
                                            {
                                                    $cnt++
                                                    $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Enabled Action: $($Item.Enabled.ToString())",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Description: $($Item.Description)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Action message: $($Item.ActionMessage)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))
                                                    $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                            }
 
  <>                                 ElseIf($RASMFASetting.Type -eq "DuoRadius")
                                    {
                                            $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))
                                            $rowdata += @(,("          Type Name",($Script:htmlsb),$RASMFASetting.DisplayName,$htmlwhite))
                                            $rowdata += @(,("          Primary Server",($Script:htmlsb),$RASMFASetting.Server,$htmlwhite))
                                            $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RASMFASetting.BackupServer,$htmlwhite))
                                            If($RASMFASetting.HAMode -eq "Parallel")
                                            {
                                                    $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))
                                            }
                                            Else
                                            {
                                                    $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))
                                            }
                                $rowdata += @(,("          Port",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.Port,$htmlwhite))                                           $rowdata += @(,("          Port",($Script:htmlsb),$RASMFASetting.Port,$htmlwhite))
                                $rowdata += @(,("          Timeout",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.Timeout,$htmlwhite))                                           $rowdata += @(,("          Timeout",($Script:htmlsb),$RASMFASetting.Timeout,$htmlwhite))
                                $rowdata += @(,("          Retries",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.Retries,$htmlwhite))                                           $rowdata += @(,("          Retries",($Script:htmlsb),$RASMFASetting.Retries,$htmlwhite))
                                $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.PasswordEncoding.ToString(),$htmlwhite))                                           $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RASMFASetting.PasswordEncoding.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.UsernameOnly.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RASMFASetting.UsernameOnly.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RAS2FASettings.AzureRadiusSettings.ForwardFirstPwdToAD.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RASMFASetting.ForwardFirstPwdToAD.ToString(),$htmlwhite))
                                $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.AzureRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                                $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.AzureRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "DuoRadius")                                   ElseIf($RASMFASetting.Type -eq "FortiRadius")
                        {                                   {
                                $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,("          Type Name",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.TypeName,$htmlwhite))                                           $rowdata += @(,("          Type Name",($Script:htmlsb),$RASMFASetting.DisplayName,$htmlwhite))
                                $rowdata += @(,("          Primary Server",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.Server,$htmlwhite))                                           $rowdata += @(,("          Primary Server",($Script:htmlsb),$RASMFASetting.Server,$htmlwhite))
                                $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RAS2FASettings.DuoRadiusSettings.BackupServer,$htmlwhite))                                           $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RASMFASetting.BackupServer,$htmlwhite))
                                If($RAS2FASettings.DuoRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))                                                   $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))                                                   $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))
                                }                                           }
                                $rowdata += @(,("          Port",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.Port,$htmlwhite))                                           $rowdata += @(,("          Port",($Script:htmlsb),$RASMFASetting.Port,$htmlwhite))
                                $rowdata += @(,("          Timeout",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.Timeout,$htmlwhite))                                           $rowdata += @(,("          Timeout",($Script:htmlsb),$RASMFASetting.Timeout,$htmlwhite))
                                $rowdata += @(,("          Retries",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.Retries,$htmlwhite))                                           $rowdata += @(,("          Retries",($Script:htmlsb),$RASMFASetting.Retries,$htmlwhite))
                                $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.PasswordEncoding.ToString(),$htmlwhite))                                           $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RASMFASetting.PasswordEncoding.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.UsernameOnly.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RASMFASetting.UsernameOnly.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RAS2FASettings.DuoRadiusSettings.ForwardFirstPwdToAD.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RASMFASetting.ForwardFirstPwdToAD.ToString(),$htmlwhite))
                                $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.DuoRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                                $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.DuoRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "FortiRadius")                                   ElseIf($RASMFASetting.Type -eq "TekRadius")
                        {                                   {
                                $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,("          Type Name",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.TypeName,$htmlwhite))                                           $rowdata += @(,("          Type Name",($Script:htmlsb),$RASMFASetting.DisplayName,$htmlwhite))
                                $rowdata += @(,("          Primary Server",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.Server,$htmlwhite))                                           $rowdata += @(,("          Primary Server",($Script:htmlsb),$RASMFASetting.Server,$htmlwhite))
                                $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RAS2FASettings.FortiRadiusSettings.BackupServer,$htmlwhite))                                           $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RASMFASetting.BackupServer,$htmlwhite))
                                If($RAS2FASettings.FortiRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))                                                   $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))                                                   $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))
                                }                                           }
                                $rowdata += @(,("          Port",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.Port,$htmlwhite))                                           $rowdata += @(,("          Port",($Script:htmlsb),$RASMFASetting.Port,$htmlwhite))
                                $rowdata += @(,("          Timeout",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.Timeout,$htmlwhite))                                           $rowdata += @(,("          Timeout",($Script:htmlsb),$RASMFASetting.Timeout,$htmlwhite))
                                $rowdata += @(,("          Retries",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.Retries,$htmlwhite))                                           $rowdata += @(,("          Retries",($Script:htmlsb),$RASMFASetting.Retries,$htmlwhite))
                                $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.PasswordEncoding.ToString(),$htmlwhite))                                           $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RASMFASetting.PasswordEncoding.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.UsernameOnly.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RASMFASetting.UsernameOnly.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RAS2FASettings.FortiRadiusSettings.ForwardFirstPwdToAD.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RASMFASetting.ForwardFirstPwdToAD.ToString(),$htmlwhite))
                                $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.FortiRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                                $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.FortiRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "TekRadius")                                   ElseIf($RASMFASetting.Type -eq "Radius")
                        {                                   {
                                $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,("          Type Name",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.TypeName,$htmlwhite))                                           $rowdata += @(,("          Type Name",($Script:htmlsb),$RASMFASetting.DisplayName,$htmlwhite))
                                $rowdata += @(,("          Primary Server",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.Server,$htmlwhite))                                           $rowdata += @(,("          Primary Server",($Script:htmlsb),$RASMFASetting.Server,$htmlwhite))
                                $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RAS2FASettings.TekRadiusSettings.BackupServer,$htmlwhite))                                           $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RASMFASetting.BackupServer,$htmlwhite))
                                If($RAS2FASettings.TekRadiusSettings.HAMode -eq "Parallel")                                           If($RASMFASetting.HAMode -eq "Parallel")
                                {                                           {
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))                                                   $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))                                                   $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))
                                }                                           }
                                $rowdata += @(,("          Port",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.Port,$htmlwhite))                                           $rowdata += @(,("          Port",($Script:htmlsb),$RASMFASetting.Port,$htmlwhite))
                                $rowdata += @(,("          Timeout",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.Timeout,$htmlwhite))                                           $rowdata += @(,("          Timeout",($Script:htmlsb),$RASMFASetting.Timeout,$htmlwhite))
                                $rowdata += @(,("          Retries",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.Retries,$htmlwhite))                                           $rowdata += @(,("          Retries",($Script:htmlsb),$RASMFASetting.Retries,$htmlwhite))
                                $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.PasswordEncoding.ToString(),$htmlwhite))                                           $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RASMFASetting.PasswordEncoding.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.UsernameOnly.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RASMFASetting.UsernameOnly.ToString(),$htmlwhite))
                                $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RAS2FASettings.TekRadiusSettings.ForwardFirstPwdToAD.ToString(),$htmlwhite))                                           $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RASMFASetting.ForwardFirstPwdToAD.ToString(),$htmlwhite))
                                $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.TekRadiusSettings.AttributeInfoList)                                           ForEach($Item in $RASMFASetting.AttributeInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                                $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))
                                $cnt=0                                           $cnt=0
                                ForEach($Item in $RAS2FASettings.TekRadiusSettings.AutomationInfoList)                                           ForEach($Item in $RASMFASetting.AutomationInfoList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                        $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line                                                   $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line
                                }                                           }
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "Radius")    
                        {    
                                $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))    
                                $rowdata += @(,("          Type Name",($Script:htmlsb),$RAS2FASettings.RadiusSettings.TypeName,$htmlwhite))    
                                $rowdata += @(,("          Primary Server",($Script:htmlsb),$RAS2FASettings.RadiusSettings.Server,$htmlwhite))    
                                $rowdata += @(,( "          Secondary server",($Script:htmlsb), $RAS2FASettings.RadiusSettings.BackupServer,$htmlwhite))    
                                If($RAS2FASettings.RadiusSettings.HAMode -eq "Parallel")    
                                {    
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - active (parallel)",$htmlwhite))    
                                }    
                                Else    
                                {    
                                        $rowdata += @(,( "          HA mode",($Script:htmlsb), "Active - passive (failover)",$htmlwhite))    
                                }    
                                $rowdata += @(,("          Port",($Script:htmlsb),$RAS2FASettings.RadiusSettings.Port,$htmlwhite))    
                                $rowdata += @(,("          Timeout",($Script:htmlsb),$RAS2FASettings.RadiusSettings.Timeout,$htmlwhite))    
                                $rowdata += @(,("          Retries",($Script:htmlsb),$RAS2FASettings.RadiusSettings.Retries,$htmlwhite))    
                                $rowdata += @(,("          Password Encoding",($Script:htmlsb),$RAS2FASettings.RadiusSettings.PasswordEncoding.ToString(),$htmlwhite))    
                                $rowdata += @(,("          Forward username only to Radius Server",($Script:htmlsb),$RAS2FASettings.RadiusSettings.UsernameOnly.ToString(),$htmlwhite))    
                                $rowdata += @(,("          Forward the first password to Windows authentication provider",($Script:htmlsb),$RAS2FASettings.RadiusSettings.ForwardFirstPwdToAD.ToString(),$htmlwhite))    
                                $rowdata += @(,( "     Attributes",($Script:htmlsb),"",$htmlwhite))    
                                $cnt=0    
                                ForEach($Item in $RAS2FASettings.RadiusSettings.AttributeInfoList)    
                                {    
                                        $cnt++    
                                        $rowdata += @(,( "",($Script:htmlsb), "Attribute $cnt",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Name: $($Item.Name)",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Vendor: $($Item.Vendor)",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Type: $($Item.AttributeType)",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Value: $($Item.Value)",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line    
                                }    
                                $rowdata += @(,( "     Automation",($Script:htmlsb),"",$htmlwhite))    
                                $cnt=0    
                                ForEach($Item in $RAS2FASettings.RadiusSettings.AutomationInfoList)    
                                {    
                                        $cnt++    
                                        $rowdata += @(,( "",($Script:htmlsb), "Automation $cnt",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Enabled: $($Item.Enabled.ToString())",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Title: $($Item.Title)",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Command: $($Item.Command)",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Image: $($Item.Image)",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "     Autosend: $($Item.AutoSend.ToString())",$htmlwhite))    
                                        $rowdata += @(,( "",($Script:htmlsb), "",$htmlwhite)) #blank separator line    
                                }    
                        }    
                        ElseIf($RAS2FASettings.Provider -eq "Deepnet")                                   ElseIf($RASMFASetting.Type -eq "Deepnet")
                        {                                   {
                                $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,( "          Type",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.DeepnetType,$htmlwhite))                                           $rowdata += @(,( "          Type",($Script:htmlsb), $RASMFASetting.DeepnetType,$htmlwhite))
                                $rowdata += @(,( "          Server",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.Server,$htmlwhite))                                           $rowdata += @(,( "          Server",($Script:htmlsb), $RASMFASetting.Server,$htmlwhite))
                                $rowdata += @(,( "          Port",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.Port.ToString(),$htmlwhite))                                           $rowdata += @(,( "          Port",($Script:htmlsb), $RASMFASetting.Port.ToString(),$htmlwhite))
                                $rowdata += @(,( "          Enable SSL",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.SSL.ToString(),$htmlwhite))                                           $rowdata += @(,( "          Enable SSL",($Script:htmlsb), $RASMFASetting.SSL.ToString(),$htmlwhite))
                                $rowdata += @(,( "          Agent",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.DeepnetAgent,$htmlwhite))                                           $rowdata += @(,( "          Agent",($Script:htmlsb), $RASMFASetting.DeepnetAgent,$htmlwhite))
                                $rowdata += @(,( "     Application",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Application",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,( "          Application",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.App,$htmlwhite))                                           $rowdata += @(,( "          Application",($Script:htmlsb), $RASMFASetting.App,$htmlwhite))
                                $rowdata += @(,( "          Domain",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.DefaultDomain,$htmlwhite))                                           $rowdata += @(,( "          Domain",($Script:htmlsb), $RASMFASetting.DefaultDomain,$htmlwhite))
                                $rowdata += @(,( "     Authentication",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Authentication",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,( "          Mode",($Script:htmlsb), $DeepNetAuthMode,$htmlwhite))                                           $rowdata += @(,( "          Mode",($Script:htmlsb), $DeepNetAuthMode,$htmlwhite))
                                $rowdata += @(,( "          Token Type",($Script:htmlsb), $RAS2FASettings.DeepnetSettings.TokenType.ToString(),$htmlwhite))                                           $rowdata += @(,( "          Token Type",($Script:htmlsb), $RASMFASetting.TokenType.ToString(),$htmlwhite))
                                $rowdata += @(,( "          Allow Channels",($Script:htmlsb), "Email: $($RAS2FASettings.DeepnetSettings.ActivateEmail.ToString())",$htmlwhite))                                           $rowdata += @(,( "          Allow Channels",($Script:htmlsb), "Email: $($RASMFASetting.ActivateEmail.ToString())",$htmlwhite))
                                $rowdata += @(,( "                        ",($Script:htmlsb), "SMS: $($RAS2FASettings.DeepnetSettings.ActivateSMS.ToString())",$htmlwhite))                                           $rowdata += @(,( "                        ",($Script:htmlsb), "SMS: $($RASMFASetting.ActivateSMS.ToString())",$htmlwhite))
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "SafeNet")                                   ElseIf($RASMFASetting.Type -eq "SafeNet")
                        {                                   {
                                Switch($RAS2FASettings.SafeNetSettings.AuthMode)                                           Switch($RASMFASetting.AuthMode)
                                {                                           {
                                        "MandatoryForAllUsers"                                          {$SafeNetAuthMode = "Mandatory for all users"; Break}                                                   "MandatoryForAllUsers"                                          {$SafeNetAuthMode = "Mandatory for all users"; Break}
                                        "CreateTokenForDomainAuthenticatedUsers"        {$SafeNetAuthMode = "Create token for Domain Authenticated users"; Break}                                                   "CreateTokenForDomainAuthenticatedUsers"        {$SafeNetAuthMode = "Create token for Domain Authenticated users"; Break}
                                        "UsersWithSafeNetAcc"                                           {$SafeNetAuthMode = "Use only for users with a safe account"; Break}                                                   "UsersWithSafeNetAcc"                                           {$SafeNetAuthMode = "Use only for users with a safe account"; Break}
                                        Default                                                                         {$SafeNetAuthMode = "Safenet mode not found: $($RAS2FASettings.SafeNetSettings.AuthMode)"; Break}                                                   Default                                                                         {$SafeNetAuthMode = "Safenet mode not found: $($RASMFASetting.AuthMode)"; Break}
                                }                                           }
 
                                $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite)) <>                                         $rowdata += @(,( "     Connection",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,( "          OTP Service URL",($Script:htmlsb),$RAS2FASettings.SafeNetSettings.OTPServiceURL,$htmlwhite))                                           $rowdata += @(,( "          OTP Service URL",($Script:htmlsb),$RASMFASetting.OTPServiceURL,$htmlwhite))
                                $rowdata += @(,( "     Authentication",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     Authentication",($Script:htmlsb),"",$htmlwhite))
                                $rowdata += @(,( "          Mode",($Script:htmlsb), $SafeNetAuthMode,$htmlwhite))                                           $rowdata += @(,( "          Mode",($Script:htmlsb), $SafeNetAuthMode,$htmlwhite))
                                $rowdata += @(,( "          TMS Web API URL",($Script:htmlsb), $RAS2FASettings.SafeNetSettings.TMSWebApiURL,$htmlwhite))                                           $rowdata += @(,( "          TMS Web API URL",($Script:htmlsb), $RASMFASetting.TMSWebApiURL,$htmlwhite))
                                $rowdata += @(,( "          User Repository",($Script:htmlsb), $RAS2FASettings.SafeNetSettings.UserRepository,$htmlwhite))                                           $rowdata += @(,( "          User Repository",($Script:htmlsb), $RASMFASetting.UserRepository,$htmlwhite))
                        }                                   }
                        ElseIf($RAS2FASettings.Provider -eq "GAuthTOTP")                                   ElseIf($RASMFASetting.Type -eq "GAuthTOTP")
                        {                                   {
                                Switch($RAS2FASettings.GAuthTOTPSettings.UserEnrollment)                                           Switch($RASMFASetting.UserEnrollment)
                                {                                           {
                                        "Allow"                 {$GAuthAllow = "Allow"; Break}                                                   "Allow"                 {$GAuthAllow = "Allow"; Break}
                                        "AllowUntil"    {$GAuthAllow = "Allow until"; Break}                                                   "AllowUntil"    {$GAuthAllow = "Allow until"; Break}
                                        "DoNotAllow"    {$GAuthAllow = "Do not allow"; Break}                                                   "DoNotAllow"    {$GAuthAllow = "Do not allow"; Break}
                                        Default                 {$GAuthAllow = "Google Authenticator Allow status not found: $($RAS2FASettings.GAuthTOTPSettings.UserEnrollment)"; Break}                                                   Default                 {$GAuthAllow = "Google Authenticator Allow status not found: $($RASMFASetting.UserEnrollment)"; Break}
                                }                                           }
                                                                          
                                Switch($RAS2FASettings.GAuthTOTPSettings.Tolerance)                                           Switch($RASMFASetting.Tolerance)
                                {                                           {
                                        0               {$TOTPTolerance = "None"; Break}                                                   0               {$TOTPTolerance = "None"; Break}
                                        30              {$TOTPTolerance = "+/- 30 seconds"; Break}                                                   30              {$TOTPTolerance = "+/- 30 seconds"; Break}
                                        60              {$TOTPTolerance = "+/- 60 seconds"; Break}                                                   60              {$TOTPTolerance = "+/- 60 seconds"; Break}
                                        90              {$TOTPTolerance = "+/- 90 seconds"; Break}                                                   90              {$TOTPTolerance = "+/- 90 seconds"; Break}
                                        120             {$TOTPTolerance = "+/- 120 seconds"; Break}                                                   120             {$TOTPTolerance = "+/- 120 seconds"; Break}
                                        Default {$TOTPTolerance = "TOTP tolerence not found: $()"; Break}                                                   Default {$TOTPTolerance = "TOTP tolerence not found: $()"; Break}
                                }                                           }
                                                                          
                                $rowdata += @(,( "     Type Name",($Script:htmlsb),$RAS2FASettings.GAuthTOTPSettings.Type,$htmlwhite))                                           $rowdata += @(,( "     Type Name",($Script:htmlsb),$RASMFASetting.Type,$htmlwhite))
                                $rowdata += @(,( "     User Enrollment",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,( "     User Enrollment",($Script:htmlsb),"",$htmlwhite))
                                If($GAuthAllow -eq "Allow until")                                           If($GAuthAllow -eq "Allow until")
                                {                                           {
                                        $GAuthFullDate = $RAS2FASettings.GAuthTOTPSettings.UntilDateTime                                                   $GAuthFullDate = $RASMFASetting.UntilDateTime
                                        $GAuthDate     = ($GAuthFullDate.ToUniversalTime()).ToShortDateString()                                                   $GAuthDate     = ($GAuthFullDate.ToUniversalTime()).ToShortDateString()
                                        $GAuthTime     = ($GAuthFullDate.ToUniversalTime()).ToLongTimeString()                                                   $GAuthTime     = ($GAuthFullDate.ToUniversalTime()).ToLongTimeString()
                                        $rowdata += @(,( "          $GAuthAllow",($Script:htmlsb),"Date: $GAuthDate",$htmlwhite))                                                   $rowdata += @(,( "          $GAuthAllow",($Script:htmlsb),"Date: $GAuthDate",$htmlwhite))
                                        $rowdata += @(,( "",($Script:htmlsb),"Time: $GAuthTime",$htmlwhite))                                                   $rowdata += @(,( "",($Script:htmlsb),"Time: $GAuthTime",$htmlwhite))
                                }                                           }
                                Else                                           Else
                                {                                           {
                                        $rowdata += @(,( "          $GAuthAllow",($Script:htmlsb),"",$htmlwhite))                                                   $rowdata += @(,( "          $GAuthAllow",($Script:htmlsb),"",$htmlwhite))
                                }                                           }
                                $rowdata += @(,( "     Authentication",($Script:htmlsb), "",$htmlwhite))                                           $rowdata += @(,( "     Authentication",($Script:htmlsb), "",$htmlwhite))
                                $rowdata += @(,( "          TOTP tolerence",($Script:htmlsb), $TOTPTolerance,$htmlwhite))                                           $rowdata += @(,( "          TOTP tolerence",($Script:htmlsb), $TOTPTolerance,$htmlwhite))
                        }                                   }
 
                        If($RAS2FASettings.RestrictionMode -eq "Exclusion") <>                                 <#If($RASMFASetting.RestrictionMode -eq "Exclusion")
                        {                                   {
                                $rowdata += @(,("Enable MFA for all users except",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,("Enable MFA for all users except",($Script:htmlsb),"",$htmlwhite))
                        }                                   }
                        Else                                   Else
                        {                                   {
                                $rowdata += @(,("Disable MFA for all users except",($Script:htmlsb),"",$htmlwhite))                                           $rowdata += @(,("Disable MFA for all users except",($Script:htmlsb),"",$htmlwhite))
                        }                                   }#>
 
                        $msg = "Provider settings" <>                                 $msg = "Provider settings"
                        $columnWidths = @("300","175")                                   $columnWidths = @("300","175")
                        FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                        WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
 
  <>                                 <#
                        $rowdata = @()                                   $rowdata = @()
                        $columnHeaders = @("User or group list",($Script:htmlsb),$RAS2FASettings.ExcludeUserGroup.ToString(),$htmlwhite)                                   $columnHeaders = @("User or group list",($Script:htmlsb),$RASMFASetting.ExcludeUserGroup.ToString(),$htmlwhite)
                        If($RAS2FASettings.ExcludeUserGroup)                                   If($RASMFASetting.ExcludeUserGroup)
                        {                                   {
                                If($RAS2FASettings.ExcludeUserGroupList.Count -gt 0)                                           If($RASMFASetting.ExcludeUserGroupList.Count -gt 0)
                                {                                           {
                                        ForEach($Item in $RAS2FASettings.ExcludeUserGroupList)                                                   ForEach($Item in $RASMFASetting.ExcludeUserGroupList)
                                        {                                                   {
                                                $rowdata += @(,("",($Script:htmlsb),"User: $($Item.Account)",$htmlwhite))                                                           $rowdata += @(,("",($Script:htmlsb),"User: $($Item.Account)",$htmlwhite))
                                                $rowdata += @(,("",($Script:htmlsb),"Type: $($Item.Type)",$htmlwhite))                                                           $rowdata += @(,("",($Script:htmlsb),"Type: $($Item.Type)",$htmlwhite))
                                                $rowdata += @(,("",($Script:htmlsb),"",$htmlwhite))                                                           $rowdata += @(,("",($Script:htmlsb),"",$htmlwhite))
                                        }                                                   }
                                }                                           }
                        }                                   }
                                                          
                        $rowdata += @(,("Client IP list",($Script:htmlsb),$RAS2FASettings.ExcludeClientIPs.ToString(),$htmlwhite))                                   $rowdata += @(,("Client IP list",($Script:htmlsb),$RASMFASetting.ExcludeClientIPs.ToString(),$htmlwhite))
                        If($RAS2FASettings.ExcludeClientIPs)                                   If($RASMFASetting.ExcludeClientIPs)
                        {                                   {
                                If($RAS2FASettings.ExcludeClientIPList.Count -gt 0)                                           If($RASMFASetting.ExcludeClientIPList.Count -gt 0)
                                {                                           {
                                        $cnt     = -1                                                   $cnt     = -1
                                        $MaxFrom = (($RAS2FASettings.ExcludeClientIPList.From | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxFrom = (($RASMFASetting.ExcludeClientIPList.From | Measure-Object -Property length -maximum).Maximum * -1)
                                        $MaxTo   = (($RAS2FASettings.ExcludeClientIPList.To | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxTo   = (($RASMFASetting.ExcludeClientIPList.To | Measure-Object -Property length -maximum).Maximum * -1)
 
                                        ForEach($Item in $RAS2FASettings.ExcludeClientIPList) <>                                                 ForEach($Item in $RASMFASetting.ExcludeClientIPList)
                                        {                                                   {
                                                $cnt++                                                           $cnt++
                                                $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)                                                           $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)
                                                                                                          
                                                If($cnt -eq 0)                                                           If($cnt -eq 0)
                                                {                                                           {
                                                        $rowdata += @(,("     IPv4 Addresses",($Script:htmlsb),$tmp,$htmlwhite))                                                                   $rowdata += @(,("     IPv4 Addresses",($Script:htmlsb),$tmp,$htmlwhite))
                                                }                                                           }
                                                Else                                                           Else
                                                {                                                           {
                                                        $rowdata += @(,("",($Script:htmlsb),$tmp,$htmlwhite))                                                                   $rowdata += @(,("",($Script:htmlsb),$tmp,$htmlwhite))
                                                }                                                           }
                                        }                                                   }
                                }                                           }
                                                                          
                                If($RAS2FASettings.ExcludeClientIPv6List.Count -gt 0)                                           If($RASMFASetting.ExcludeClientIPv6List.Count -gt 0)
                                {                                           {
                                        $cnt     = -1                                                   $cnt     = -1
                                        $MaxFrom = (($RAS2FASettings.ExcludeClientIPv6List.From | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxFrom = (($RASMFASetting.ExcludeClientIPv6List.From | Measure-Object -Property length -maximum).Maximum * -1)
                                        $MaxTo   = (($RAS2FASettings.ExcludeClientIPv6List.To | Measure-Object -Property length -maximum).Maximum * -1)                                                   $MaxTo   = (($RASMFASetting.ExcludeClientIPv6List.To | Measure-Object -Property length -maximum).Maximum * -1)
 
                                        ForEach($Item in $RAS2FASettings.ExcludeClientIPv6List) <>                                                 ForEach($Item in $RASMFASetting.ExcludeClientIPv6List)
                                        {                                                   {
                                                $cnt++                                                           $cnt++
                                                $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)                                                           $tmp = ("From: {0,$($MaxFrom)} To: {1,$($MaxTo)}" -f $Item.From, $Item.To)
                                                                                                          
                                                If($cnt -eq 0)                                                           If($cnt -eq 0)
                                                {                                                           {
                                                        $rowdata += @(,("     IPv6 Addresses",($Script:htmlsb),$tmp,$htmlwhite))                                                                   $rowdata += @(,("     IPv6 Addresses",($Script:htmlsb),$tmp,$htmlwhite))
                                                }                                                           }
                                                Else                                                           Else
                                                {                                                           {
                                                        $rowdata += @(,("",($Script:htmlsb),$tmp,$htmlwhite))                                                                   $rowdata += @(,("",($Script:htmlsb),$tmp,$htmlwhite))
                                                }                                                           }
                                        }                                                   }
                                }                                           }
                        }                                   }
                        $rowdata += @(,("Client MAC list",($Script:htmlsb),$RAS2FASettings.ExcludeClientMAC.ToString(),$htmlwhite))                                   $rowdata += @(,("Client MAC list",($Script:htmlsb),$RASMFASetting.ExcludeClientMAC.ToString(),$htmlwhite))
                        If($RAS2FASettings.ExcludeClientMAC)                                   If($RASMFASetting.ExcludeClientMAC)
                        {                                   {
                                $cnt = -1                                           $cnt = -1
                                ForEach($MAC in $RAS2FASettings.ExcludeClientMACList)                                           ForEach($MAC in $RASMFASetting.ExcludeClientMACList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                                                                          
                                        If($cnt -eq 0)                                                   If($cnt -eq 0)
                                        {                                                   {
                                                $rowdata += @(,("     MAC Address",($Script:htmlsb),$MAC,$htmlwhite))                                                           $rowdata += @(,("     MAC Address",($Script:htmlsb),$MAC,$htmlwhite))
                                        }                                                   }
                                        Else                                                   Else
                                        {                                                   {
                                                $rowdata += @(,("",($Script:htmlsb),$MAC,$htmlwhite))                                                           $rowdata += @(,("",($Script:htmlsb),$MAC,$htmlwhite))
                                        }                                                   }
                                }                                           }
                        }                                   }
                        $rowdata += @(,("Connection to the following Gateway IPs",($Script:htmlsb),$RAS2FASettings.ExcludeClientGWIPs.ToString(),$htmlwhite))                                   $rowdata += @(,("Connection to the following Gateway IPs",($Script:htmlsb),$RASMFASetting.ExcludeClientGWIPs.ToString(),$htmlwhite))
                        If($RAS2FASettings.ExcludeClientGWIPs)                                   If($RASMFASetting.ExcludeClientGWIPs)
                        {                                   {
                                $cnt = -1                                           $cnt = -1
                                ForEach($Server in $RAS2FASettings.ExcludeClientGWIPList)                                           ForEach($Server in $RASMFASetting.ExcludeClientGWIPList)
                                {                                           {
                                        $cnt++                                                   $cnt++
                                                                                          
                                        If($cnt -eq 0)                                                   If($cnt -eq 0)
                                        {                                                   {
                                                $rowdata += @(,("     Server Name",($Script:htmlsb),$Server,$htmlwhite))                                                           $rowdata += @(,("     Server Name",($Script:htmlsb),$Server,$htmlwhite))
                                        }                                                   }
                                        Else                                                   Else
                                        {                                                   {
                                                $rowdata += @(,("",($Script:htmlsb),$Server,$htmlwhite))                                                           $rowdata += @(,("",($Script:htmlsb),$Server,$htmlwhite))
                                        }                                                   }
                                }                                           }
                        }                                   }
                }                                   
                $msg = "Restriction"                                   $msg = "Restriction"
                $columnWidths = @("300","175")                                   $columnWidths = @("300","175")
                FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths                                   FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
                WriteHTMLLine 0 0 ""                                   WriteHTMLLine 0 0 ""
                                    #>
                $rowdata = @()    
                $columnHeaders = @("Settings are replicated to all Sites",($Script:htmlsb),$RAS2FASettings.ReplicateSettings.ToString(),$htmlwhite)    
                            }
                $msg = ""                   }
                $columnWidths = @("300","175")    
                FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths    
                WriteHTMLLine 0 0 ""    
 
                        ClientStatus       = $RASAllowedDevices.AllowClientWindows <>                         ClientStatus       = $RASAllowedDevices.AllowClientAndroid
                        ClientName         = "Windows client"                           ClientName         = "Android client"
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildWindows                           ClientMinimumBuild = $RASAllowedDevices.MinBuildAndroid
 
                        ClientStatus       = $RASAllowedDevices.AllowClientMAC <>                         ClientStatus       = $RASAllowedDevices.AllowClientChromeApp
                        ClientName         = "macOS client"                           ClientName         = "Chrome OS client"
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildMAC                           ClientMinimumBuild = $RASAllowedDevices.MinBuildChromeApp
                    }
                    
                    $AllowedDevicesWordTable += @{
                            ClientStatus       = $RASAllowedDevices.AllowClientIOS
                            ClientName         = "iOS/iPadOS client"
                            ClientMinimumBuild = $RASAllowedDevices.MinBuildIOS
 
                        ClientStatus       = $RASAllowedDevices.AllowClientIOS <>                         ClientStatus       = $RASAllowedDevices.AllowClientMAC
                        ClientName         = "iOS client"                           ClientName         = "macOS client"
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildIOS                           ClientMinimumBuild = $RASAllowedDevices.MinBuildMAC
 
                        ClientStatus       = $RASAllowedDevices.AllowClientAndroid <>  
                        ClientName         = "Android client"    
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildAndroid    
                }    
                    
                $AllowedDevicesWordTable += @{    
                        ClientStatus       = $RASAllowedDevices.AllowClientHTML5                           ClientStatus       = $RASAllowedDevices.AllowClientWeb
                        ClientName         = "HTML5 client"    
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildHTML5    
                }    
                    
                $AllowedDevicesWordTable += @{    
                        ClientStatus       = $RASAllowedDevices.AllowClientChromeApp    
                        ClientName         = "Chrome client"                           ClientName         = "User Portal (Web client)"
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildChromeApp                           ClientMinimumBuild = $RASAllowedDevices.MinBuildWeb
 
                        ClientStatus       = $RASAllowedDevices.AllowClientWebPortal <>                         ClientStatus       = $RASAllowedDevices.AllowClientWindows
                        ClientName         = "RAS Web Portal"                           ClientName         = "Windows client"
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildWebPortal                           ClientMinimumBuild = $RASAllowedDevices.MinBuildWindows
 
                $AllowedDevicesWordTable += @{ +-  
                        ClientStatus       = $RASAllowedDevices.AllowClientJava    
                        ClientName         = "Java client"    
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildJava    
                }    
                    
                $AllowedDevicesWordTable += @{    
                        ClientStatus       = $RASAllowedDevices.AllowClientWinPhone    
                        ClientName         = "Windows Phone client"    
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildWinPhone    
                }    
                    
                $AllowedDevicesWordTable += @{    
                        ClientStatus       = $RASAllowedDevices.AllowClientBlackberry    
                        ClientName         = "Blackberry client"    
                        ClientMinimumBuild = $RASAllowedDevices.MinBuildBlackberry    
                }    
                    
                $AllowedDevicesWordTable += @{    
                        ClientStatus       = $RASAllowedDevices.AllowClient2XOS    
                        ClientName         = "2X OS client"    
                        ClientMinimumBuild = $RASAllowedDevices.MinBuild2XOS    
                }    
     
 
  -+                 Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientWeb, "User Portal (Web client)", $RASAllowedDevices.MinBuildWeb)
 
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientIOS, "iOS client", $RASAllowedDevices.MinBuildIOS) <>                 Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientIOS, "iOS/iPadOS client", $RASAllowedDevices.MinBuildIOS)
 
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientHTML5, "HTML5 client", $RASAllowedDevices.MinBuildHTML5) <>  
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientChromeApp, "Chrome client", $RASAllowedDevices.MinBuildChromeApp)                   Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientChromeApp, "Chrome OS client", $RASAllowedDevices.MinBuildChromeApp)
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientWebPortal, "RAS Web Portal", $RASAllowedDevices.MinBuildWebPortal)    
 
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientJava, "Java client", $RASAllowedDevices.MinBuildJava) +-  
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientWinPhone, "Windows Phone client", $RASAllowedDevices.MinBuildWinPhone)    
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClientBlackberry, "Blackberry client", $RASAllowedDevices.MinBuildBlackberry)    
                Line 2 ( "{0,-7} {1,-20} {2,-4}" -f $RASAllowedDevices.AllowClient2XOS, "2X OS client", $RASAllowedDevices.MinBuild2XOS)    
 
  -+                 $rowdata += @(,($RASAllowedDevices.AllowClientWeb,$htmlwhite,"User Portal (Web client)",$htmlwhite,$RASAllowedDevices.MinBuildWeb,$htmlwhite))
 
                $rowdata += @(,($RASAllowedDevices.AllowClientIOS,$htmlwhite,"iOS client",$htmlwhite,$RASAllowedDevices.MinBuildIOS,$htmlwhite)) <>                 $rowdata += @(,($RASAllowedDevices.AllowClientIOS,$htmlwhite,"iOS/iPadOS client",$htmlwhite,$RASAllowedDevices.MinBuildIOS,$htmlwhite))
 
                $rowdata += @(,($RASAllowedDevices.AllowClientHTML5,$htmlwhite,"HTML5 client",$htmlwhite,$RASAllowedDevices.MinBuildHTML5,$htmlwhite)) <>  
                $rowdata += @(,($RASAllowedDevices.AllowClientChromeApp,$htmlwhite,"Chrome client",$htmlwhite,$RASAllowedDevices.MinBuildChromeApp,$htmlwhite))                   $rowdata += @(,($RASAllowedDevices.AllowClientChromeApp,$htmlwhite,"Chrome OS client",$htmlwhite,$RASAllowedDevices.MinBuildChromeApp,$htmlwhite))
                $rowdata += @(,($RASAllowedDevices.AllowClientWebPortal,$htmlwhite,"RAS Web Portal",$htmlwhite,$RASAllowedDevices.MinBuildWebPortal,$htmlwhite))    
 
                $rowdata += @(,($RASAllowedDevices.AllowClientJava,$htmlwhite,"Java client",$htmlwhite,$RASAllowedDevices.MinBuildJava,$htmlwhite)) +-  
                $rowdata += @(,($RASAllowedDevices.AllowClientWinPhone,$htmlwhite,"Windows Phone client",$htmlwhite,$RASAllowedDevices.MinBuildWinPhone,$htmlwhite))    
                $rowdata += @(,($RASAllowedDevices.AllowClientBlackberry,$htmlwhite,"Blackberry client",$htmlwhite,$RASAllowedDevices.MinBuildBlackberry,$htmlwhite))    
                $rowdata += @(,($RASAllowedDevices.AllowClient2XOS,$htmlwhite,"2X OS client",$htmlwhite,$RASAllowedDevices.MinBuild2XOS,$htmlwhite))    
 
                $columnWidths = @("54","125","100") <>                 $columnWidths = @("55","175","100")
 
                $ClientOptions   = $Policy.ClientPolicy.ClientOptions <>                 <#$ClientOptions   = $Policy.ClientPolicy.ClientOptions
 
                $Session         = $Policy.ClientPolicy.Session <>                 $Session         = $Policy.ClientPolicy.Session#>
 
                $GWType = "" <>                 $GatewayType = ""
                Switch($Policy.GWRule)                   Switch($Policy.GatewayRule)
 
  <>                         "Any"                           {$GatewayType = "if Client is connected to any gateway"; Break}
                        "AnyGW"                         {$GWType = "if Client is connected to any gateway"; Break}                           "AnyGW"                         {$GatewayType = "if Client is connected to any gateway"; Break}
                            "Connected"                     {$GatewayType = "if Client is connected to one of the following gateways"; Break}
                        "ConnectedToGWs"        {$GWType = "if Client is connected to one of the following gateways"; Break}                           "ConnectedToGWs"        {$GatewayType = "if Client is connected to one of the following gateways"; Break}
                            "NotConnected"          {$GatewayType = "if Client is not connecteed to one of the following gateways"; Break}
                        "NotConnectedToGWs"     {$GWType = "if Client is not connecteed to one of the following gateways"; Break}                           "NotConnectedToGWs"     {$GatewayType = "if Client is not connecteed to one of the following gateways"; Break}
                        Default                         {$GWType = "Policy/Criteria/Gateway criteria type not found: $($Policy.GWRule)"; Break}                           Default                         {$GatewayType = "Policy/Criteria/Gateway criteria type not found: $($Policy.GatewayRule)"; Break}
 
                        $ScriptInformation.Add(@{Data = "Policy/Criteria/Gateway criteria/Apply policy"; Value = $GWType; }) > $Null <>                         $ScriptInformation.Add(@{Data = "Policy/Criteria/Gateway criteria/Apply policy"; Value = $GatewayType; }) > $Null
                        If($Policy.GWRule -ne "AnyGW")                           If($Policy.GatewayRule -ne "AnyGW")
 
                                ForEach($GW in $Policy.GWList) <>                                 ForEach($Gateway in $Policy.GatewayList)
 
                                        $ScriptInformation.Add(@{Data = ""; Value = $GW; }) > $Null <>                                         $ScriptInformation.Add(@{Data = ""; Value = $Gateway; }) > $Null
 
                        $ScriptInformation.Add(@{Data = "Policy/Criteria/Parallels client criteria/HTML5"; Value = $Policy.AllowedOSes.HTML5.ToString(); }) > $Null +-  
 
  -+                         $ScriptInformation.Add(@{Data = "Policy/Criteria/Parallels client criteria/WebClient"; Value = $Policy.AllowedOSes.WebClient.ToString(); }) > $Null
 
                        Line 3 "Policy/Criteria/Gateway criteria/Apply policy: " $GWType <>                         Line 3 "Policy/Criteria/Gateway criteria/Apply policy: " $GatewayType
                        If($Policy.GWRule -ne "AnyGW")                           If($Policy.GatewayRule -ne "AnyGW")
 
                                ForEach($GW in $Policy.GWList) <>                                 ForEach($Gateway in $Policy.GatewayList)
 
                                        Line 7 "  " $GW <>                                         Line 7 "  " $Gateway
 
                        Line 3 "Policy/Criteria/Parallels client criteria/HTML5: " $Policy.AllowedOSes.HTML5.ToString() <>                         Line 3 "Policy/Criteria/Parallels client criteria/WebClient: " $Policy.AllowedOSes.WebClient.ToString()
 
                        $columnHeaders = @("Policy/Criteria/Gateway criteria/Apply policy",($Script:htmlsb),$GWType,$htmlwhite) <>                         $columnHeaders = @("Policy/Criteria/Gateway criteria/Apply policy",($Script:htmlsb),$GatewayType,$htmlwhite)
                        If($Policy.GWRule -ne "AnyGW")                           If($Policy.GatewayRule -ne "AnyGW")
 
                                ForEach($GW in $Policy.GWList) <>                                 ForEach($Gateway in $Policy.GatewayList)
 
                                        $rowdata += @(,("",($Script:htmlsb),$GW,$htmlwhite)) <>                                         $rowdata += @(,("",($Script:htmlsb),$Gateway,$htmlwhite))
 
                        $rowdata += @(,("Policy/Criteria/Parallels client criteria/HTML5",($Script:htmlsb),$Policy.AllowedOSes.HTML5.ToString(),$htmlwhite)) <>                         $rowdata += @(,("Policy/Criteria/Parallels client criteria/WebClient",($Script:htmlsb),$Policy.AllowedOSes.WebClient.ToString(),$htmlwhite))
 
                                $GWMode = "" <>                                 $GatewayMode = ""
 
                                        "DirectMode"            {$GWMode = "Direct Mode"; Break} <>                                         "DirectMode"            {$GatewayMode = "Direct Mode"; Break}
                                        "DirectSSLMode"         {$GWMode = "Direct SSL Mode"; Break}                                           "DirectSSLMode"         {$GatewayMode = "Direct SSL Mode"; Break}
                                        "GatewayMode"           {$GWMode = "Gateway Mode"; Break}                                           "GatewayMode"           {$GatewayMode = "Gateway Mode"; Break}
                                        "GatewaySSLMode"        {$GWMode = "Gateway SSL Mode"; Break}                                           "GatewaySSLMode"        {$GatewayMode = "Gateway SSL Mode"; Break}
                                        Default                         {$GWMode = "Secondary connections/Secondary connections/Mode not found: $($Item.Mode)"; Break}                                           Default                         {$GatewayMode = "Secondary connections/Secondary connections/Mode not found: $($Item.Mode)"; Break}
 
                                                Value = "Connection: $($Item.Server)   Mode: $GWMode   Port: $($Item.ServerPort.ToString())"; <>                                                 Value = "Connection: $($Item.Server)   Mode: $GatewayMode   Port: $($Item.ServerPort.ToString())";
 
                                                "Connection: $($Item.Server)   Mode: $GWMode   Port: $($Item.ServerPort.ToString())",$htmlwhite)) <>                                                 "Connection: $($Item.Server)   Mode: $GatewayMode   Port: $($Item.ServerPort.ToString())",$htmlwhite))
 
                                                OutputPolicySetting $txt "Connection: $($Item.Server)   Mode: $GWMode   Port: $($Item.ServerPort.ToString())" <>                                                 OutputPolicySetting $txt "Connection: $($Item.Server)   Mode: $GatewayMode   Port: $($Item.ServerPort.ToString())"
 
                                                Value = "Connection: $($Item.Server)   Mode: $GWMode   Port: $($Item.ServerPort.ToString())"; <>                                                 Value = "Connection: $($Item.Server)   Mode: $GatewayMode   Port: $($Item.ServerPort.ToString())";
 
                                                "Connection: $($Item.Server)   Mode: $GWMode   Port: $($Item.ServerPort.ToString())",$htmlwhite)) <>                                                 "Connection: $($Item.Server)   Mode: $GatewayMode   Port: $($Item.ServerPort.ToString())",$htmlwhite))
 
                                                OutputPolicySetting "`t`t`t`t`t`t`t      " "Connection: $($Item.Server)   Mode: $GWMode   Port: $($Item.ServerPort.ToString())" <>                                                 OutputPolicySetting "`t`t`t`t`t`t`t      " "Connection: $($Item.Server)   Mode: $GatewayMode   Port: $($Item.ServerPort.ToString())"
 
                Write-Verbose "$(Get-Date -Format G): `t`t`t`tSession/Local devices and resources/Disk drives" <>                 Write-Verbose "$(Get-Date -Format G): `t`t`t`tSession/Local devices and resources/Disk drives and folders"
 
                        $txt = "Session/Local devices and resources/Disk drives/Disk drives/Allow disk drives redirection" <>                         $txt = "Session/Local devices and resources/Disk drives and folders/Disk drives and folders/Allow disk drives redirection"
 
                        $txt = "Session/Local devices and resources/Disk drives/Disk drives/Use all disk drives available" <>                         $txt = "Session/Local devices and resources/Disk drives and folders/Disk drives and folders/Use all disk drives available"
 
                        $txt = "Session/Local devices and resources/Disk drives/Disk drives/Use also disk drives that I plug in later" <>                         $txt = "Session/Local devices and resources/Disk drives and folders/Disk drives and folders/Use also disk drives that I plug in later"
 
                        If($Policy.ClientPolicy.ClientOptions.Logging.LogLevel -ne "Verbose")   #Verbose from PoSH equals Standard in the console - weird <>                         If($Policy.ClientPolicy.ClientOptions.Logging.LogLevel -ne "Standard")
 
  -+                                         0               {$LogDuration = ""; Break}
 
                        $txt = "Client options/Advanced/Printing/Redirect custom paper sizes when server preferences are selected" <>                         <#$txt = "Client options/Advanced/Printing/Redirect custom paper sizes when server preferences are selected"
 
                        } <>                         }#>
 
                                $columnWidths = @("400","300") <>                                 $columnWidths = @("600","300")
 
        $RASFeatures = Get-RASSystemSettings -EA 0 4>$Null <>         $RASFeatures = Get-RASHelpdeskEmailSettings -EA 0 4>$Null
 
  <>         }
     
            Write-Verbose "$(Get-Date -Format G): `tProcessing Settings"
            
            $GotRASSettings = $False
            $RASSettings = Get-RASSystemSettings -EA 0 4>$Null
            
            If(!($?))
            {
                    Write-Warning "
                    `n
                    Unable to retrieve settings information
                    "
                    If($MSWord -or $PDF)
                    {
                            WriteWordLine 0 0 "Unable to retrieve settings information"
                    }
                    If($Text)
                    {
                            Line 0 "Unable to retrieve settings information"
                    }
                    If($HTML)
                    {
                            WriteHTMLLine 0 0 "Unable to retrieve settings information"
                    }
            }
            ElseIf($? -and $null -eq $RASsettings)
            {
                    Write-Host "
                    No settings information was found
                    " -ForegroundColor White
                    If($MSWord -or $PDF)
                    {
                            WriteWordLine 0 0 "No settings information was found"
                    }
                    If($Text)
                    {
                            Line 0 "No settings information was found"
                    }
                    If($HTML)
                    {
                            WriteHTMLLine 0 0 "No settings information was found"
                    }
            }
            Else
            {
                    $GotRASSettings = $True
                OutputRASSettings $RASFeatures                   OutputRASSettings $RASSettings
 
  -+         $RASProxySettings = Get-RASProxySettings -EA 0 4>$Null
            
            If(!($?))
            {
                    Write-Warning "
                    `n
                    Unable to retrieve Proxy settings information
                    "
                    If($MSWord -or $PDF)
                    {
                            WriteWordLine 0 0 "Unable to retrieve Proxy settings information"
                    }
                    If($Text)
                    {
                            Line 0 "Unable to retrieve Proxy settings information"
                    }
                    If($HTML)
                    {
                            WriteHTMLLine 0 0 "Unable to retrieve Proxy settings information"
                    }
            }
            ElseIf($? -and $null -eq $RASProxySettings)
            {
                    Write-Host "
                    No Proxy settings information was found
                    " -ForegroundColor White
                    If($MSWord -or $PDF)
                    {
                            WriteWordLine 0 0 "No Proxy settings information was found"
                    }
                    If($Text)
                    {
                            Line 0 "No Proxy settings information was found"
                    }
                    If($HTML)
                    {
                            WriteHTMLLine 0 0 "No Proxy settings information was found"
                    }
            }
            Else
            {
                    OutputRASProxySettings $RASProxySettings
            }
     
            If($GotRASSettings)
            {
                    OutputRASMiscSettings $RASSettings
            }
            
 
        Param([object] $RASFeatures) <>         Param([object] $RASSettings)
 
                $ScriptInformation.Add(@{Data = "Participate in the Customer Experience Program"; Value = $RASFeatures.CEPEnabled.ToString(); }) > $Null <>                 $ScriptInformation.Add(@{Data = "Participate in the Customer Experience Program"; Value = $RASSettings.CEPEnabled.ToString(); }) > $Null
 
                Line 3 "Participate in the Customer Experience Program`t`t: " $RASFeatures.CEPEnabled.ToString() <>                 Line 3 "Participate in the Customer Experience Program`t`t: " $RASSettings.CEPEnabled.ToString()
 
                $columnHeaders = @("Participate in the Customer Experience Program",($Script:htmlsb),$RASFeatures.CEPEnabled.ToString(),$htmlwhite) <>                 $columnHeaders = @("Participate in the Customer Experience Program",($Script:htmlsb),$RASSettings.CEPEnabled.ToString(),$htmlwhite)
 
  -+ }
 
  -+ Function OutputRASProxySettings
    {
            Param([object] $RASProxySettings)
            
            Write-Verbose "$(Get-Date -Format G): `t`tOutput HTTP Proxy Settings"
            
 
                If($RASFeatures.HttpProxyMode -eq "NoProxy") <>                 If($RASProxySettings.HttpProxyMode -eq "NoProxy")
 
                        $ScriptInformation.Add(@{Data = "Address"; Value = $RASFeatures.HttpProxyAddress; }) > $Null <>                         $ScriptInformation.Add(@{Data = "Address"; Value = $RASProxySettings.HttpProxyAddress; }) > $Null
                        $ScriptInformation.Add(@{Data = "Port"; Value = $RASFeatures.HttpProxyPort; }) > $Null                           $ScriptInformation.Add(@{Data = "Port"; Value = $RASProxySettings.HttpProxyPort; }) > $Null
                        $ScriptInformation.Add(@{Data = "User name"; Value = $RASFeatures.HttpProxyUser; }) > $Null                           $ScriptInformation.Add(@{Data = "User name"; Value = $RASProxySettings.HttpProxyUser; }) > $Null
                        $ScriptInformation.Add(@{Data = "Password"; Value = $RASFeatures.HttpProxyPwd; }) > $Null                           $ScriptInformation.Add(@{Data = "Password"; Value = $RASProxySettings.HttpProxyPwd; }) > $Null
 
                If($RASFeatures.HttpProxyMode -eq "NoProxy") <>                 If($RASProxySettings.HttpProxyMode -eq "NoProxy")
 
                        Line 3 "Address`t`t: " $RASFeatures.HttpProxyAddress <>                         Line 3 "Address`t`t: " $RASProxySettings.HttpProxyAddress
                        Line 3 "Port`t`t: " $RASFeatures.HttpProxyPort                           Line 3 "Port`t`t: " $RASProxySettings.HttpProxyPort
                        Line 3 "User name`t: " $RASFeatures.HttpProxyUser                           Line 3 "User name`t: " $RASProxySettings.HttpProxyUser
                        Line 3 "Password`t: " $RASFeatures.HttpProxyPwd                           Line 3 "Password`t: " $RASProxySettings.HttpProxyPwd
 
                If($RASFeatures.HttpProxyMode -eq "NoProxy") <>                 If($RASProxySettings.HttpProxyMode -eq "NoProxy")
 
                        $rowdata += @(,("Address",($Script:htmlsb),$RASFeatures.HttpProxyAddress,$htmlwhite)) <>                         $rowdata += @(,("Address",($Script:htmlsb),$RASProxySettings.HttpProxyAddress,$htmlwhite))
                        $rowdata += @(,("Port",($Script:htmlsb),$RASFeatures.HttpProxyPort.ToString(),$htmlwhite))                           $rowdata += @(,("Port",($Script:htmlsb),$RASProxySettings.HttpProxyPort.ToString(),$htmlwhite))
                        $rowdata += @(,("User name",($Script:htmlsb),$RASFeatures.HttpProxyUser,$htmlwhite))                           $rowdata += @(,("User name",($Script:htmlsb),$RASProxySettings.HttpProxyUser,$htmlwhite))
                        $rowdata += @(,("Password",($Script:htmlsb),$RASFeatures.HttpProxyPwd,$htmlwhite))                           $rowdata += @(,("Password",($Script:htmlsb),$RASProxySettings.HttpProxyPwd,$htmlwhite))
 
  -+ }
 
  -+ Function OutputRASMiscSettings
    {
            Param([object] $RASSettings)
            
            Write-Verbose "$(Get-Date -Format G): `t`tOutput Miscellaneous Settings"
            
 
        Switch ($RASFeatures.ResetIdleSessionAfterMins) <>         Switch ($RASSettings.ResetIdleSessionAfterMins)
 
                0               {$RASFeaturesResetIdleSessionAfterMins = "Never"; Break} <>                 0               {$RASSettingsResetIdleSessionAfterMins = "Never"; Break}
                15              {$RASFeaturesResetIdleSessionAfterMins = "15 minutes"; Break}                   15              {$RASSettingsResetIdleSessionAfterMins = "15 minutes"; Break}
                30              {$RASFeaturesResetIdleSessionAfterMins = "30 minutes"; Break}                   30              {$RASSettingsResetIdleSessionAfterMins = "30 minutes"; Break}
                60              {$RASFeaturesResetIdleSessionAfterMins = "1 hour"; Break}                   60              {$RASSettingsResetIdleSessionAfterMins = "1 hour"; Break}
                180             {$RASFeaturesResetIdleSessionAfterMins = "3 hours"; Break}                   180             {$RASSettingsResetIdleSessionAfterMins = "3 hours"; Break}
                360             {$RASFeaturesResetIdleSessionAfterMins = "6 hours"; Break}                   360             {$RASSettingsResetIdleSessionAfterMins = "6 hours"; Break}
                720             {$RASFeaturesResetIdleSessionAfterMins = "12 hours"; Break}                   720             {$RASSettingsResetIdleSessionAfterMins = "12 hours"; Break}
                1440    {$RASFeaturesResetIdleSessionAfterMins = "1 day"; Break}                   1440    {$RASSettingsResetIdleSessionAfterMins = "1 day"; Break}
                Default {$RASFeaturesResetIdleSessionAfterMins = "Unable to determine Console idle time: $($RASFeatures.ResetIdleSessionAfterMins)"; Break}                   Default {$RASSettingsResetIdleSessionAfterMins = "Unable to determine Console idle time: $($RASSettings.ResetIdleSessionAfterMins)"; Break}
 
                $ScriptInformation.Add(@{Data = "Reset idle RAS Console session after"; Value = $RASFeaturesResetIdleSessionAfterMins; }) > $Null <>                 $ScriptInformation.Add(@{Data = "Reset idle RAS Console session after"; Value = $RASSettingsResetIdleSessionAfterMins; }) > $Null
 
                Line 3 "Reset idle RAS Console session after`t`t`t: " $RASFeaturesResetIdleSessionAfterMins <>                 Line 3 "Reset idle RAS Console session after`t`t`t: " $RASSettingsResetIdleSessionAfterMins
 
                $columnHeaders = @("Reset idle RAS Console session after",($Script:htmlsb),$RASFeaturesResetIdleSessionAfterMins,$htmlwhite) <>                 $columnHeaders = @("Reset idle RAS Console session after",($Script:htmlsb),$RASSettingsResetIdleSessionAfterMins,$htmlwhite)
 
  -+                 "3"                                     {$RASMailboxSettingsUseTLS = "Use TLS 1.2 if available"; Break}
 
                        "RDSHConnectSessionEvent"               {$RASNotificationText = "RDSH sessions utilization $RASNotificationHandlerDirection $($RASNotificationHandler.Threshold) %"; Break} <>                         "RDSHConnectSessionEvent"               {$RASNotificationText = "RDSH active sessions utilization $RASNotificationHandlerDirection $($RASNotificationHandler.Threshold) %"; Break}
 
  <>                         "34660353"                                              {$RASNotificationText = "AVD active sessions utilization $RASNotificationHandlerDirection $($RASNotificationHandler.Threshold) %"; Break}
                            "34660354"                                              {$RASNotificationText = "AVD disconnected sessions utilization $RASNotificationHandlerDirection $($RASNotificationHandler.Threshold)"; Break}
                        "TunneledSess"                                  {$RASNotificationText = "Number of gateway tunnelled sessions $RASNotificationHandlerDirection $($RASNotificationHandler.Threshold)"; Break}                           "TunneledSess"                                  {$RASNotificationText = "Number of Secure Gateway tunnelled sessions $RASNotificationHandlerDirection $($RASNotificationHandler.Threshold)"; Break}
                        "GW"                                                    {$RASNotificationText = "Failed gateway tunnelled sessions"; Break}                           "GW"                                                    {$RASNotificationText = "Failed Secure Gateway tunnelled sessions"; Break}
                        "1097729"                                               {$RASNotificationText = "Failed gateway tunnelled sessions"; Break}                           "1097729"                                               {$RASNotificationText = "Failed Secure Gateway tunnelled sessions"; Break}
 
                        "45056"                                                 {$RASNotificationText = "Tenants"; Break} <>                         "45056"                                                 {$RASNotificationText = "Tenants events"; Break}
 
  +-  
                        #"CPU"                                                  {$RASNotificationText = ""; Break}    
                        #"Disk"                                                 {$RASNotificationText = ""; Break}    
                        #"Memory"                                               {$RASNotificationText = ""; Break}    
                        #"RDSH"                                                 {$RASNotificationText = ""; Break}    
 
                $GracePeriod           = ($RASNotificationHandler.GracePeriod / 60) <>                 $GracePeriod           = ($RASNotificationHandler.GracePeriod.ToString())
                $NotificationsInterval = ($RASNotificationHandler.Interval / 60)                   $NotificationsInterval = ($RASNotificationHandler.Interval.ToString())
 
                        $columnWidths = @("200","225") <>                         $columnWidths = @("250","225")
 
  -+ }
     
    Function OutputRASClientSettings
    {
            Param([object] $RASClientSettings)
     
            <#
            ExcludeDirectRDP         :
            ExcludeDirectRDPForVDI   :
            SendHDIcons              : True
            ReplicateSendHDIcons     : True
            EnableOverlayIcons       : True
            ShowPasswordExpiry       : False
            TokenValidationExpireMin : 60
            #>
     
            If($MSWord -or $PDF)
            {
                    WriteWordLine 3 0 "Client settings"
                    $ScriptInformation = New-Object System.Collections.ArrayList
                    $ScriptInformation.Add(@{Data = "Published application icons"; Value = ""; }) > $Null
                    $ScriptInformation.Add(@{Data = "     Resolution:"; Value = ""; }) > $Null
                    If($RASClientSettings.SendHDIcons)
                    {
                            $ScriptInformation.Add(@{Data = "          High resolution icons (uses more network bandwidth)"; Value = ""; }) > $Null
                    }
                    Else
                    {
                            $ScriptInformation.Add(@{Data = "          Standard resolution icons"; Value = ""; }) > $Null
                    }
                    $ScriptInformation.Add(@{Data = "     Overlay:"; Value = ""; }) > $Null
                    $ScriptInformation.Add(@{Data = "          $($RASClientSettings.EnableOverlayIcons.ToString())"; Value = ""; }) > $Null
                    $ScriptInformation.Add(@{Data = "Password notifications"; Value = ""; }) > $Null
                    $ScriptInformation.Add(@{Data = "     Show password expiration reminder"; Value = $RASClientSettings.ShowPasswordExpiry.ToString(); }) > $Null
                    $ScriptInformation.Add(@{Data = "Settings are replicated to all Sites"; Value = $RASClientSettings.ReplicateSendHDIcons.ToString(); }) > $Null
     
                    $Table = AddWordTable -Hashtable $ScriptInformation `
                    -Columns Data,Value `
                    -List `
                    -Format $wdTableGrid `
                    -AutoFit $wdAutoFitFixed;
     
                    SetWordCellFormat -Collection $Table -Size 10 -BackgroundColor $wdColorWhite
                    SetWordCellFormat -Collection $Table.Columns.Item(1).Cells -Bold -BackgroundColor $wdColorGray15;
     
                    $Table.Columns.Item(1).Width = 200;
                    $Table.Columns.Item(2).Width = 250;
     
                    $Table.Rows.SetLeftIndent($Indent0TabStops,$wdAdjustProportional)
     
                    FindWordDocumentEnd
                    $Table = $Null
     
                    WriteWordLine 0 0 ""
            }
            If($Text)
            {
                    Line 2 "Client settings"
                    Line 3 "Published application icons"
                    Line 4 "Resolution:"
                    If($RASClientSettings.SendHDIcons)
                    {
                            Line 5 "High resolution (uses more network bandwidth)"
                    }
                    Else
                    {
                            Line 5 "Standard resolution"
                    }
                    Line 4 "Overlay:"
                    Line 5 "Enable overlay icon`t`t`t: " $RASClientSettings.EnableOverlayIcons.ToString()
                    LIne 3 "Password notifications"
                    Line 4 "Show password expiration reminder`t: " $RASClientSettings.ShowPasswordExpiry.ToString()
                    Line 3 "Settings are replicated to all Sites`t: " $RASClientSettings.ReplicateSendHDIcons.ToString()
                    Line 0 ""
            }
            If($HTML)
            {
                    WriteHTMLLine 3 0 "Client settings"
                    $rowdata = @()
                    $columnHeaders = @("Published application icons",($Script:htmlsb),"S",$htmlwhite)
                    $rowdata += @(,("     Resolution:",($Script:htmlsb),"",$htmlwhite))
                    If($RASClientSettings.SendHDIcons)
                    {
                            $rowdata += @(,("          High resolution (uses more network bandwidth)",($Script:htmlsb),"",$htmlwhite))
                    }
                    Else
                    {
                            $rowdata += @(,("          Standard resolution",($Script:htmlsb),"",$htmlwhite))
                    }
                    $rowdata += @(,("     Overlay:",($Script:htmlsb),"",$htmlwhite))
                    $rowdata += @(,("          $($RASClientSettings.EnableOverlayIcons.ToString())",($Script:htmlsb),"",$htmlwhite))
                    $rowdata += @(,("Password notifications",($Script:htmlsb),"",$htmlwhite))
                    $rowdata += @(,("     Show password expiration reminder",($Script:htmlsb),$RASClientSettings.ShowPasswordExpiry.ToString(),$htmlwhite))
                    $rowdata += @(,("Settings are replicated to all Sites",($Script:htmlsb),$RASClientSettings.ReplicateSendHDIcons.ToString(),$htmlwhite))
     
                    $msg = ""
                    $columnWidths = @("200","275")
                    FormatHTMLTable $msg "auto" -rowArray $rowdata -columnArray $columnHeaders -fixedWidth $columnWidths
     
                    WriteHTMLLine 0 0 ""
            }
     
 
ProcessPolicies #new in 18.1 <> ProcessPolicies